[Libpst-commits] r50 - trunk

Joseph Nahmias jello at alioth.debian.org
Thu Dec 7 05:02:23 CET 2006


Author: jello
Date: 2006-12-07 05:02:23 +0100 (Thu, 07 Dec 2006)
New Revision: 50

Modified:
   trunk/libpst.c
Log:
make sure buf3 is freed in _pst_ff_compile_ID()

Modified: trunk/libpst.c
===================================================================
--- trunk/libpst.c	2006-12-07 03:55:13 UTC (rev 49)
+++ trunk/libpst.c	2006-12-07 04:02:23 UTC (rev 50)
@@ -4095,8 +4095,10 @@
   unsigned char fdepth;
 
   DEBUG_ENT("_pst_ff_compile_ID");
-  if ((a = _pst_ff_getIDblock(pf, id, &buf3))==0)
+  if ((a = _pst_ff_getIDblock(pf, id, &buf3))==0) {
+    if (buf3) free(buf3);
     return 0;
+  }
   if ((buf3[0] != 0x1)) { // if bit 8 is set) {
     //  if ((buf3)[0] != 0x1 && (buf3)[1] > 4) {
     DEBUG_WARN(("WARNING: buffer doesn't start with 0x1, but I expected it to or doesn't have it's two-bit set!\n"));
@@ -4108,10 +4110,10 @@
     else if (h->base64 == 1 && h->fp != NULL) {
       t = base64_encode(buf3, a);
       pst_fwrite(t, 1, strlen(t), h->fp);
-      free(buf3);
+      free(buf3); buf3 = NULL;
     } else if (h->fp != NULL) {
       pst_fwrite(buf3, 1, a, h->fp);
-      free(buf3);
+      free(buf3); buf3 = NULL;
     }
     DEBUG_RET();
     return a;




More information about the Libpst-commits mailing list