diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-09-10 17:02:54 +0900 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-09-10 17:02:54 +0900 |
commit | fbded00b0df5ba7663bddc8e5842a3a118a3c0b3 (patch) | |
tree | 177a650ba4346331586d7cd597020dc2cc137351 /compat | |
parent | Merge branch 'rs/unpack-entry-leakfix' into maint (diff) | |
parent | win32: plug memory leak on realloc() failure in syslog() (diff) | |
download | tgif-fbded00b0df5ba7663bddc8e5842a3a118a3c0b3.tar.xz |
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()
Diffstat (limited to 'compat')
-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; } |