From: Matt O'Gorman Date: Thu, 2 Nov 2006 17:12:56 +0000 (+0000) Subject: read then commit.... better fix for bug 8083 as X-Git-Tag: 1.2.14~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=769113c53f43b0969c756f2f269fcb751888dacc;p=thirdparty%2Fasterisk.git read then commit.... better fix for bug 8083 as suggested by my peers git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.2@46962 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/logger.c b/logger.c index fcc0797ad1..6bfc5eae18 100644 --- a/logger.c +++ b/logger.c @@ -875,10 +875,8 @@ void ast_verbose(const char *fmt, ...) if (complete) { if (msgcnt < MAX_MSG_QUEUE) { /* Allocate new structure */ - if ((m = malloc(sizeof(*m)))) { - m->msg = NULL; + if ((m = calloc(1, sizeof(*m)))) msgcnt++; - } } else { /* Recycle the oldest entry */ m = list; @@ -887,7 +885,6 @@ void ast_verbose(const char *fmt, ...) free(m->msg); } if (m) { - m->msg = NULL; m->msg = strdup(stuff); if (m->msg) { if (last)