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
This commit is contained in:
Matt O'Gorman
2006-11-01 21:20:35 +00:00
parent d4b36ffde5
commit 3ac718e5f4

View File

@@ -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)