summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2022-06-08 21:27:50 (GMT)
committerJunio C Hamano <gitster@pobox.com>2022-06-08 21:27:50 (GMT)
commit596838d2c564f3fea30315d4bd6633c32f70bfed (patch)
tree1de857a4523314d75eb781a9c5fe043a8b99becc /compat
parente54793a95afeea1e10de1e5ad7eab914e7416250 (diff)
parent2acf4cf0010379f10b39eba1fb4e0868a5ba4114 (diff)
downloadgit-596838d2c564f3fea30315d4bd6633c32f70bfed.zip
git-596838d2c564f3fea30315d4bd6633c32f70bfed.tar.gz
git-596838d2c564f3fea30315d4bd6633c32f70bfed.tar.bz2
Merge branch 'js/ci-gcc-12-fixes' into maint
Fixes real problems noticed by gcc 12 and works around false positives. source: <pull.1238.git.1653351786.gitgitgadget@gmail.com> * js/ci-gcc-12-fixes: dir.c: avoid "exceeds maximum object size" error with GCC v12.x nedmalloc: avoid new compile error compat/win32/syslog: fix use-after-realloc
Diffstat (limited to 'compat')
-rw-r--r--compat/nedmalloc/nedmalloc.c1
-rw-r--r--compat/win32/syslog.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/compat/nedmalloc/nedmalloc.c b/compat/nedmalloc/nedmalloc.c
index edb438a..2c0ace7 100644
--- a/compat/nedmalloc/nedmalloc.c
+++ b/compat/nedmalloc/nedmalloc.c
@@ -323,7 +323,6 @@ static NOINLINE void RemoveCacheEntries(nedpool *p, threadcache *tc, unsigned in
}
static void DestroyCaches(nedpool *p) THROWSPEC
{
- if(p->caches)
{
threadcache *tc;
int n;
diff --git a/compat/win32/syslog.c b/compat/win32/syslog.c
index 161978d..1f8d893 100644
--- a/compat/win32/syslog.c
+++ b/compat/win32/syslog.c
@@ -43,6 +43,7 @@ void syslog(int priority, const char *fmt, ...)
va_end(ap);
while ((pos = strstr(str, "%1")) != NULL) {
+ size_t offset = pos - str;
char *oldstr = str;
str = realloc(str, st_add(++str_len, 1));
if (!str) {
@@ -50,6 +51,7 @@ void syslog(int priority, const char *fmt, ...)
warning_errno("realloc failed");
return;
}
+ pos = str + offset;
memmove(pos + 2, pos + 1, strlen(pos));
pos[1] = ' ';
}