In particular return before we have allocated 'str' with
attribute((cleanup)) so that we don't waste time calling free (NULL)
on the hot-ish path out of the function.
---
server/debug.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/server/debug.c b/server/debug.c
index 2231d40a0..8afa0ae8b 100644
--- a/server/debug.c
+++ b/server/debug.c
@@ -69,6 +69,9 @@ prologue (FILE *fp)
static void
debug_common (bool in_server, const char *fs, va_list args)
{
+ if (!verbose)
+ return;
+
int err = errno;
#ifndef WIN32
int tty;
@@ -77,9 +80,6 @@ debug_common (bool in_server, const char *fs, va_list args)
size_t len = 0;
FILE *fp;
- if (!verbose)
- return;
-
fp = open_memstream (&str, &len);
if (fp == NULL) {
fail:
--
2.39.2