cURL / Mailing Lists / curl-library / Single Mail

curl-library

[ curl-Bugs-934666 ] storage leak in ftp.c

From: SourceForge.net <noreply_at_sourceforge.net>
Date: Tue, 13 Apr 2004 19:12:00 -0700

Bugs item #934666, was opened at 2004-04-13 19:11
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=934666&group_id=976

Category: ftp
Group: wrong behaviour
Status: Open
Resolution: None
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Daniel Stenberg (bagder)
Summary: storage leak in ftp.c

Initial Comment:
Storage leak in ftp.c.
Tested against 7.11.1, using libcurl in Windows.
Submitted by mbp
at cadalog hyphen inc dot com.

In ftp.c, the lines 2400-2405 are:
  else
    freedirs(ftp);

   ftp->ctl_valid = TRUE;
  return retcode;
}

They should be:
  else {
    freedirs(ftp);
    if(ftp->file) {
      free(ftp->file);
      ftp->file = NULL;
    }
  }

  ftp->ctl_valid = TRUE;
  return retcode;
}

If you check the mtime of a file on a FTP server, and the
file does not exist (and the FTP server does exist), then
ftp->file is not freed.

example code:
        curl_easy_setopt(m_curlHandle, CURLOPT_URL, "ftp:
//xxx.yyy/zzz");
        curl_easy_setopt(m_curlHandle, CURLOPT_FILETIME,
1);
        curl_easy_setopt(m_curlHandle, CURLOPT_NOBODY,
1);
        int rc = curl_easy_perform(m_curlHandle);

----------------------------------------------------------------------

You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=100976&aid=934666&group_id=976
Received on 2004-04-14