Skip to contentSkip to conversation

Bad free() call

PATCH Joel Aelwyn 1 participant 1 message Sep 15, 2005

lore
Share & tools
lore
#0 lore raw

While poking around at writing a patch that supports per-list recipient delimiters (basically done, but needs testing under 'live fire' still), I came across a free() call that should be myfree() in prepstdreply.c (it isn't caught due to the fact that prepstdreply.c doesn't have any reason to #include mlmmj.h, where the automated warning about this lives). It's minor, but I figure that also makes it easy to apply until 1.2.9 comes out, for anyone that cares; patch attached.

Actually, having looked over prepstdreply.c further, I think I see quite a few memory leaks in the form of not calling myfree() at all, when something has been allocated, but several of them would be best handled (or at least, most simply handled) by rearranging the logic to not allocate things until needed - however, I don't feel competent enough with the codebase yet to try something of quite that magnitude. Well, not and post it in public without more testing than I have time to do right now, anyway...

Signature · 1 line
Joel Aelwyn <[email protected]>
prepstdreply.c renamed from prepstdreply.c.orig +1 -1
diff -urNad src/prepstdreply.c.orig src/prepstdreply.c
@@ -181,7 +181,7 @@
 	if(replyto) {
 		myreplyto = substitute(replyto, listaddr, tokencount, data);
 		tmp = concatstr(3, "Reply-To: ", myreplyto, "\n");
-		free(myreplyto);
+		myfree(myreplyto);
 		myreplyto = tmp;
 	} else
 		myreplyto = NULL;