From: Matt O'Gorman Date: Wed, 1 Nov 2006 21:20:35 +0000 (+0000) Subject: fix for bug #8083 crash caused by double free on m->msg X-Git-Tag: 1.2.14~86 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3ac718e5f41e7e783471aedffc6b795f0ce9160e;p=thirdparty%2Fasterisk.git fix for bug #8083 crash caused by double free on m->msg git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@46838 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/logger.c b/logger.c index 85a75d117c..fcc0797ad1 100644 --- a/logger.c +++ b/logger.c @@ -875,15 +875,19 @@ void ast_verbose(const char *fmt, ...) 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)