aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--logger.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/logger.c b/logger.c
index 85a75d117..fcc0797ad 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)