From d34fc386bafc29058cc82fe902b4b6f55abd1a57 Mon Sep 17 00:00:00 2001 From: Nuno Lopes Date: Sat, 11 Nov 2006 23:36:52 +0000 Subject: [PATCH] MFB :fix leak in oo_setArchiveComment.phpt --- ext/zip/lib/zip_free.c | 3 +++ ext/zip/lib/zip_set_archive_comment.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/zip/lib/zip_free.c b/ext/zip/lib/zip_free.c index cbead2a6b7..c78697d254 100644 --- a/ext/zip/lib/zip_free.c +++ b/ext/zip/lib/zip_free.c @@ -59,6 +59,9 @@ _zip_free(struct zip *za) if (za->zp) fclose(za->zp); + if (za->ch_comment) + free(za->ch_comment); + _zip_cdir_free(za->cdir); if (za->entry) { diff --git a/ext/zip/lib/zip_set_archive_comment.c b/ext/zip/lib/zip_set_archive_comment.c index 51a8416da4..b0929e56b6 100644 --- a/ext/zip/lib/zip_set_archive_comment.c +++ b/ext/zip/lib/zip_set_archive_comment.c @@ -60,7 +60,7 @@ zip_set_archive_comment(struct zip *za, const char *comment, int len) else tmpcom = NULL; - free(za->ch_comment); + if (za->ch_comment) free(za->ch_comment); za->ch_comment = tmpcom; za->ch_comment_len = len; -- 2.50.1