summaryrefslogtreecommitdiff
path: root/trace.c
diff options
context:
space:
mode:
authorJohannes Sixt <j6t@kdbg.org>2010-05-08 17:18:06 +0200
committerJunio C Hamano <gitster@pobox.com>2010-05-08 22:28:01 -0700
commit3a0942598ce33b195bfaaf250b2da23e4eceb3c6 (patch)
treeafce18ab3896d8705becafeeea96da86ca17ff4d /trace.c
parent851c34b04e0ce866e15c28e144986eca7533a6f4 (diff)
downloadgit-3a0942598ce33b195bfaaf250b2da23e4eceb3c6.tar.gz
Do not call release_pack_memory in malloc wrappers when GIT_TRACE is used
This avoids a potential race condition when async procedures are implemented as threads where release_pack_memory() can be called from different threads without locking under memory pressure. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'trace.c')
-rw-r--r--trace.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/trace.c b/trace.c
index 4229ae1231..1e560cb0b9 100644
--- a/trace.c
+++ b/trace.c
@@ -25,6 +25,10 @@
#include "cache.h"
#include "quote.h"
+void do_nothing(size_t unused)
+{
+}
+
/* Get a trace file descriptor from GIT_TRACE env variable. */
static int get_trace_fd(int *need_close)
{
@@ -72,6 +76,7 @@ void trace_printf(const char *fmt, ...)
if (!fd)
return;
+ set_try_to_free_routine(do_nothing); /* is never reset */
strbuf_init(&buf, 64);
va_start(ap, fmt);
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);
@@ -103,6 +108,7 @@ void trace_argv_printf(const char **argv, const char *fmt, ...)
if (!fd)
return;
+ set_try_to_free_routine(do_nothing); /* is never reset */
strbuf_init(&buf, 64);
va_start(ap, fmt);
len = vsnprintf(buf.buf, strbuf_avail(&buf), fmt, ap);