[Libpst-commits] r47 - trunk

Joseph Nahmias jello at alioth.debian.org
Thu Dec 7 02:59:35 CET 2006


Author: jello
Date: 2006-12-07 02:59:34 +0100 (Thu, 07 Dec 2006)
New Revision: 47

Modified:
   trunk/libpst.c
Log:
make sure na and list2 are freed in pst_load_extended_attributes()

Modified: trunk/libpst.c
===================================================================
--- trunk/libpst.c	2006-12-07 01:42:08 UTC (rev 46)
+++ trunk/libpst.c	2006-12-07 01:59:34 UTC (rev 47)
@@ -377,7 +377,7 @@
   pst_desc_ll *p;
   pst_num_array *na;
   //  pst_index_ll *list;
-  pst_index2_ll *list2;//, *t;
+  pst_index2_ll *list2;
   unsigned char * buffer=NULL, *headerbuffer=NULL;//, *tc;
   pst_x_attrib xattrib;
   int32_t bptr = 0, bsize, hsize, tint, err=0, x;
@@ -393,11 +393,13 @@
     list2 = _pst_build_id2(pf, p->list_index, NULL);
   }
   if (p->desc == NULL) {
+    if (list2) _pst_free_id2(list2);
     DEBUG_WARN(("desc is NULL for item 0x61. Cannot load Extended Attributes\n"));
     DEBUG_RET();
     return 0;
   }
   if ((na = _pst_parse_block(pf, p->desc->id, list2)) == NULL) {
+    if (list2) _pst_free_id2(list2);
     DEBUG_WARN(("Cannot process desc block for item 0x61. Not loading extended Attributes\n"));
     DEBUG_RET();
     return 0;
@@ -415,6 +417,8 @@
   }
 
   if (buffer == NULL) {
+    if (na) _pst_free_list(na);
+    if (list2) _pst_free_id2(list2);
     DEBUG_WARN(("No extended attributes buffer found. Not processing\n"));
     DEBUG_RET();
     return 0;
@@ -490,10 +494,8 @@
     LE16_CPU(xattrib.map);
     bptr += sizeof(xattrib);
   }
-  if (buffer)
-    free(buffer);
-  if (headerbuffer)
-    free(headerbuffer);
+  if (list2) _pst_free_id2(list2);
+  if (na) _pst_free_list(na);
   pf->x_head = p_head;
   DEBUG_RET();
   return 1;




More information about the Libpst-commits mailing list