Thread
Thread Index
-
patch to fix leak and binary mode on windows,
Pierre Joye
(2010/02/01 19:55:23)
Message
hi,
Here is two patches against 0.9.3:
- fix leak, archive comment is not freed on close
- force binary mode on windows in zip close (you will have to add a
def for Windows, I use WINDOWS in this patch), it is required as the b
mode is ignored (or can be)
Cheers,
--
Pierre
@pierrejoye | http://blog.thepimp.net | http://www.libgd.org
--- G:/projects/zip/libzip-0.9.3/lib/zip_close.c Mon Feb 01 20:48:45 2010
+++ G:/projects/zip/libzip-0.9.3patched/lib/zip_close.c Mon Feb 01 20:48:12 2010
@@ -310,6 +310,8 @@
mask = umask(0);
umask(mask);
chmod(za->zn, 0666&~mask);
+ if (za->ch_comment)
+ free(za->ch_comment);
_zip_free(za);
free(temp);
--- G:/projects/zip/libzip-0.9.3/lib/zip_close.c Mon Feb 01 20:48:45 2010
+++ G:/projects/zip/libzip-0.9.3patched/lib/zip_close.c Mon Feb 01 20:51:59 2010
@@ -310,6 +310,8 @@
mask = umask(0);
umask(mask);
chmod(za->zn, 0666&~mask);
+ if (za->ch_comment)
+ free(za->ch_comment);
_zip_free(za);
free(temp);
@@ -664,7 +666,9 @@
free(temp);
return NULL;
}
-
+#ifdef WINDOWS
+ _setmode(_fileno(tfp), _O_BINARY );
+#endif
*outp = tfp;
return temp;
}
Made by MHonArc.
|