[asterisk-commits] mogorman: branch 1.2 r46838 - /branches/1.2/logger.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Nov 1 14:20:36 MST 2006


Author: mogorman
Date: Wed Nov  1 15:20:35 2006
New Revision: 46838

URL: http://svn.digium.com/view/asterisk?rev=46838&view=rev
Log:
fix for bug #8083 crash caused by double free on m->msg

Modified:
    branches/1.2/logger.c

Modified: branches/1.2/logger.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/logger.c?rev=46838&r1=46837&r2=46838&view=diff
==============================================================================
--- branches/1.2/logger.c (original)
+++ branches/1.2/logger.c Wed Nov  1 15:20:35 2006
@@ -875,15 +875,19 @@
 	if (complete) {
 		if (msgcnt < MAX_MSG_QUEUE) {
 			/* Allocate new structure */
-			if ((m = malloc(sizeof(*m))))
+			if ((m = malloc(sizeof(*m)))) {
+				m->msg = NULL;
 				msgcnt++;
+			}
 		} else {
 			/* Recycle the oldest entry */
 			m = list;
 			list = list->next;
-			free(m->msg);
+			if (m->msg)
+				free(m->msg);
 		}
 		if (m) {
+			m->msg = NULL;
 			m->msg = strdup(stuff);
 			if (m->msg) {
 				if (last)



More information about the asterisk-commits mailing list