diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-08-22 10:29:16 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-08-22 10:29:16 -0700 |
commit | b8feb6ef2300c7e36c9888ec87571aff0e5f495b (patch) | |
tree | edecac89b8d8aab28cfa4604d023edc1aec630bd | |
parent | Merge branch 'rs/unpack-entry-leakfix' (diff) | |
parent | win32: plug memory leak on realloc() failure in syslog() (diff) | |
download | tgif-b8feb6ef2300c7e36c9888ec87571aff0e5f495b.tar.xz |
Merge branch 'rs/win32-syslog-leakfix'
Memory leak in an error codepath has been plugged.
* rs/win32-syslog-leakfix:
win32: plug memory leak on realloc() failure in syslog()
-rw-r--r-- | compat/win32/syslog.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/compat/win32/syslog.c b/compat/win32/syslog.c index 6c7c9b6053..161978d720 100644 --- a/compat/win32/syslog.c +++ b/compat/win32/syslog.c @@ -43,8 +43,10 @@ void syslog(int priority, const char *fmt, ...) va_end(ap); while ((pos = strstr(str, "%1")) != NULL) { + char *oldstr = str; str = realloc(str, st_add(++str_len, 1)); if (!str) { + free(oldstr); warning_errno("realloc failed"); return; } |