diff src/debug.c @ 37:ddfb25318812 stable-0-5-8

more valgrind fixes
author carl
date Fri, 10 Aug 2007 08:06:13 -0700
parents 6fe121a971c9
children f6db1f060a95
line wrap: on
line diff
--- a/src/debug.c	Thu Aug 09 15:46:34 2007 -0700
+++ b/src/debug.c	Fri Aug 10 08:06:13 2007 -0700
@@ -321,7 +321,7 @@
 	fseek(debug_fp, 0, SEEK_END);
 	item_ptr = item_head = item_tail = NULL;
 	free(index);
-	if (buf) free(buf); buf = NULL;
+	if (buf) free(buf);
 }
 
 
@@ -330,7 +330,7 @@
 	struct _debug_file_rec_m mfile_rec;
 	unsigned char rec_type;
 	int index_size = 3 * sizeof(int);
-	int *index = malloc(index_size);
+	int index[3];
 	int index_pos, file_pos;
 	char zero='\0';
 	unsigned int end;
@@ -381,7 +381,6 @@
 		fwrite(&mfile_rec, sizeof(mfile_rec), 1, debug_fp);
 	}
 	fseek(debug_fp, 0, SEEK_END);
-	// that should do it...
 }
 
 
@@ -389,10 +388,9 @@
 	struct _debug_file_rec_l lfile_rec;
 	unsigned char rec_type;
 	int index_size = 3 * sizeof(int);
-	int index_pos, file_pos, *index;
+	int index_pos, file_pos, index[3];
 	char zero='\0';
 	if (!debug_fp) return;	// no file
-	index = malloc(index_size);
 	index[0] = 1; // only one item in this index run
 	index[1] = 0; // valgrind, avoid writing uninitialized data
 	index[2] = 0; // ""
@@ -434,7 +432,7 @@
 		fprintf(stderr, "xMalloc: Out Of memory [req: %ld]\n", (long)size);
 		exit(1);
 	}
-	memset(mem, 0, size);	// valgrind, some email attachment does not initialize the entire buffer passed to base64 encode
+  //memset(mem, 0, size);	// valgrind
 	return mem;
 }