Merge branch 'rs/win32-syslog-leakfix' into maint
Memory leak in an error codepath has been plugged. * rs/win32-syslog-leakfix: win32: plug memory leak on realloc() failure in syslog()
This commit is contained in:
@ -43,8 +43,10 @@ void syslog(int priority, const char *fmt, ...)
|
|||||||
va_end(ap);
|
va_end(ap);
|
||||||
|
|
||||||
while ((pos = strstr(str, "%1")) != NULL) {
|
while ((pos = strstr(str, "%1")) != NULL) {
|
||||||
|
char *oldstr = str;
|
||||||
str = realloc(str, st_add(++str_len, 1));
|
str = realloc(str, st_add(++str_len, 1));
|
||||||
if (!str) {
|
if (!str) {
|
||||||
|
free(oldstr);
|
||||||
warning_errno("realloc failed");
|
warning_errno("realloc failed");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user