Commit ccf65be0 authored by Daniel Stenberg's avatar Daniel Stenberg
Browse files

fixed minor memory leak when running out of memory

parent 7dfef132
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -779,8 +779,10 @@ CURLcode Curl_ftp_done(struct connectdata *conn, CURLcode status)
  dlen = strlen(path)-flen;
  if(dlen) {
    ftp->prevpath = malloc(dlen + 1);
    if(!ftp->prevpath)
    if(!ftp->prevpath) {
      free(path);
      return CURLE_OUT_OF_MEMORY;
    }
    memcpy(ftp->prevpath, path, dlen);
    ftp->prevpath[dlen]=0; /* terminate */
    infof(data, "Remembering we are in dir %s\n", ftp->prevpath);