Browse code

More upstream patches

git-svn: trunk@2543

Nigel Horne authored on 2006/12/08 01:05:15
Showing 1 changed files
... ...
@@ -36,7 +36,7 @@
36 36
  * TODO: Remove the vcard handling
37 37
  * FIXME: The code does little error checking of OOM scenarios
38 38
  */
39
-static	char	const	rcsid[] = "$Id: pst.c,v 1.37 2006/12/07 11:06:24 njh Exp $";
39
+static	char	const	rcsid[] = "$Id: pst.c,v 1.38 2006/12/07 16:05:15 njh Exp $";
40 40
 
41 41
 #if HAVE_CONFIG_H
42 42
 #include "clamav-config.h"	/* must come first */
... ...
@@ -904,7 +904,6 @@ pst_load_extended_attributes(pst_file *pf)
904 904
   pst_x_attrib xattrib;
905 905
   int32_t bptr = 0, bsize, hsize, tint, err=0, x;
906 906
   pst_x_attrib_ll *ptr, *p_head=NULL, *p_sh=NULL, *p_sh2=NULL;
907
-  char *wt;
908 907
 
909 908
   if ((p = _pst_getDptr(pf, 0x61)) == NULL) {
910 909
     cli_warnmsg("Cannot find DescID 0x61 for loading the Extended Attributes\n");
... ...
@@ -916,11 +915,12 @@ pst_load_extended_attributes(pst_file *pf)
916 916
 		list2 = NULL;
917 917
 
918 918
   if (p->desc == NULL) {
919
+    if(list2) _pst_free_id2(list2);
919 920
     cli_warnmsg("desc is NULL for item 0x61. Cannot load Extended Attributes\n");
920 921
     return 0;
921 922
   }
922 923
   if ((na = _pst_parse_block(pf, p->desc->id, list2)) == NULL) {
923
-	_pst_free_id2(list2);
924
+    if(list2) _pst_free_id2(list2);
924 925
     cli_warnmsg("Cannot process desc block for item 0x61. Not loading extended Attributes\n");
925 926
     return 0;
926 927
   }
... ...
@@ -938,8 +938,8 @@ pst_load_extended_attributes(pst_file *pf)
938 938
   }
939 939
 
940 940
 	if (buffer == NULL) {
941
-		_pst_free_list(na);
942
-		_pst_free_id2(list2);
941
+		if(na) _pst_free_list(na);
942
+		if(list2)_pst_free_id2(list2);
943 943
 
944 944
 		cli_warnmsg("No extended attributes buffer found. Not processing\n");
945 945
 		return 0;
... ...
@@ -963,6 +963,7 @@ pst_load_extended_attributes(pst_file *pf)
963 963
     if (xattrib.type & 0x0001) { // if the Bit 1 is set
964 964
       // pointer to Unicode field in buffer
965 965
       if (xattrib.extended < hsize) {
966
+	char *wt;
966 967
 	// copy the size of the header. It is 32 bit int
967 968
 	memcpy(&tint, &(headerbuffer[xattrib.extended]), sizeof(tint));
968 969
 	LE32_CPU(tint);
... ...
@@ -1011,8 +1012,8 @@ pst_load_extended_attributes(pst_file *pf)
1011 1011
     bptr += sizeof(xattrib);
1012 1012
   }
1013 1013
   pf->x_head = p_head;
1014
-	_pst_free_list(na);
1015
-	_pst_free_id2(list2);
1014
+	if(list2) _pst_free_id2(list2);
1015
+	if(na) _pst_free_list(na);
1016 1016
   return 1;
1017 1017
 }
1018 1018