diff --git a/ext/ftp/ftp.c b/ext/ftp/ftp.c index b980d697089..bce51ab6ee7 100644 --- a/ext/ftp/ftp.c +++ b/ext/ftp/ftp.c @@ -1646,9 +1646,11 @@ ftp_genlist(ftpbuf_t *ftp, const char *cmd, const char *path TSRMLS_DC) return ret; bail: - data_close(ftp, data); + if (data) + data_close(ftp, data); fclose(tmpfp); - efree(ret); + if (ret) + efree(ret); return NULL; } /* }}} */