summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-09-10 17:02:54 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-09-10 17:02:54 +0900
commitfbded00b0df5ba7663bddc8e5842a3a118a3c0b3 (patch)
tree177a650ba4346331586d7cd597020dc2cc137351 /compat
parentMerge branch 'rs/unpack-entry-leakfix' into maint (diff)
parentwin32: plug memory leak on realloc() failure in syslog() (diff)
downloadtgif-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.c2
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;
}