From: Sara Golemon Date: Tue, 9 Sep 2003 21:15:20 +0000 (+0000) Subject: MFH(r-1.91) Fix Bug #25294 LIST/NLST can cause segfault because ftp->data not cleaned... X-Git-Tag: php-4.3.4RC1~81 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3f585ac9238ebdce0198e447f6ce8399d247df02;p=php MFH(r-1.91) Fix Bug #25294 LIST/NLST can cause segfault because ftp->data not cleaned properly --- diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index 1d20ec2fc3..01710ec656 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -421,9 +421,10 @@ ftp_chdir(ftpbuf_t *ftp, const char *dir) { if (ftp == NULL) return 0; - if (ftp->pwd) + if (ftp->pwd) { efree(ftp->pwd); - ftp->pwd = NULL; + ftp->pwd = NULL; + } if (!ftp_putcmd(ftp, "CWD", dir)) return 0; @@ -442,9 +443,10 @@ ftp_cdup(ftpbuf_t *ftp) if (ftp == NULL) return 0; - if (ftp->pwd) + if (ftp->pwd) { efree(ftp->pwd); - ftp->pwd = NULL; + ftp->pwd = NULL; + } if (!ftp_putcmd(ftp, "CDUP", NULL)) return 0; @@ -1535,8 +1537,7 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC) return ret; bail: - if (data) - ftp->data = data_close(ftp, data); + ftp->data = data_close(ftp, data); fclose(tmpfp); if (ret) efree(ret);