Fixed leaks of va_lists
This commit is contained in:
parent
bd8f8807ff
commit
12501d599c
10
src/log.c
10
src/log.c
@ -138,22 +138,19 @@ log_message(int level, char *fmt, ...)
|
|||||||
if (!log_message_storage) {
|
if (!log_message_storage) {
|
||||||
log_message_storage = vector_create();
|
log_message_storage = vector_create();
|
||||||
if (!log_message_storage)
|
if (!log_message_storage)
|
||||||
return;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
vsnprintf(str, STRING_LENGTH, fmt, args);
|
vsnprintf(str, STRING_LENGTH, fmt, args);
|
||||||
|
|
||||||
entry_buffer = safemalloc(strlen(str) + 6);
|
entry_buffer = safemalloc(strlen(str) + 6);
|
||||||
if (!entry_buffer)
|
if (!entry_buffer)
|
||||||
return;
|
goto out;
|
||||||
|
|
||||||
sprintf(entry_buffer, "%d %s", level, str);
|
sprintf(entry_buffer, "%d %s", level, str);
|
||||||
vector_append(log_message_storage, entry_buffer,
|
vector_append(log_message_storage, entry_buffer,
|
||||||
strlen(entry_buffer) + 1);
|
strlen(entry_buffer) + 1);
|
||||||
|
goto out;
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
#ifdef HAVE_SYSLOG_H
|
#ifdef HAVE_SYSLOG_H
|
||||||
if (config.syslog) {
|
if (config.syslog) {
|
||||||
@ -185,6 +182,7 @@ log_message(int level, char *fmt, ...)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
out:
|
||||||
va_end(args);
|
va_end(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user