/
uis
/
git
/
x
/
uis
/
git
/
git.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
7234152
)
win32: plug memory leak on realloc() failure in syslog()
author
René Scharfe
<l.s.r@web.de>
Thu, 10 Aug 2017 10:23:45 +0000
(12:23 +0200)
committer
Junio C Hamano
<gitster@pobox.com>
Thu, 10 Aug 2017 20:57:52 +0000
(13:57 -0700)
If realloc() fails then the original buffer is still valid. Free it
before exiting the function.
Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
compat/win32/syslog.c
patch
|
blob
|
blame
|
history
diff --git
a/compat/win32/syslog.c
b/compat/win32/syslog.c
index
6c7c9b6
..
161978d
100644
(file)
--- 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;
}