[Libpst-commits] r51 - trunk

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


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

Modified:
   trunk/libpst.c
Log:
_pst_build_id_ptr(): make sure buf is always freed

Modified: trunk/libpst.c
===================================================================
--- trunk/libpst.c	2006-12-07 04:02:23 UTC (rev 50)
+++ trunk/libpst.c	2006-12-07 04:46:23 UTC (rev 51)
@@ -520,6 +520,7 @@
     x = 0;
 
     if (_pst_read_block_size(pf, offset, BLOCK_SIZE, &buf, 0, 0) < BLOCK_SIZE) {
+      if (buf) free(buf);
       DEBUG_WARN(("Not read the full block size of the index. There is a problem\n"));
       DEBUG_RET();
       return -1;
@@ -553,6 +554,7 @@
       //      if (index.u1 & 0x2 || index.u1 & 0x4) { 
       // ignore the above condition. it doesn't appear to hold
       if (old > index.id) { // then we have back-slid on the new values
+	if (buf) free(buf);
 	DEBUG_INDEX(("Back slider detected - Old value [%#x] greater than new [%#x]. Progressing to next table\n", old, index.id));
 	DEBUG_RET();
 	return 2;
@@ -600,6 +602,7 @@
     ret = 0;
 
     if (_pst_read_block_size(pf, offset, BLOCK_SIZE, &buf, 0, 0) < BLOCK_SIZE) {
+      if (buf) free(buf);
       DEBUG_WARN(("Not read the full block size of the index. There is a problem\n"));
       DEBUG_RET();
       return -1;




More information about the Libpst-commits mailing list