]> granicus.if.org Git - php/commitdiff
MFB :fix leak in oo_setArchiveComment.phpt
authorNuno Lopes <nlopess@php.net>
Sat, 11 Nov 2006 23:36:52 +0000 (23:36 +0000)
committerNuno Lopes <nlopess@php.net>
Sat, 11 Nov 2006 23:36:52 +0000 (23:36 +0000)
ext/zip/lib/zip_free.c
ext/zip/lib/zip_set_archive_comment.c

index cbead2a6b7e8a0c8d71ebf478d37a3fcf861888b..c78697d2540e66e3d0276773ddcc47acb92d2eff 100644 (file)
@@ -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) {
index 51a8416da428b68233c2972f620d6231810ea76f..b0929e56b6d5953df1c02a6286d3ed83a87c5839 100644 (file)
@@ -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;