Fix leak WRT wrbuf usage
[pazpar2-moved-to-github.git] / src / http_command.c
index bbd6b83..4684d26 100644 (file)
@@ -543,7 +543,7 @@ static void cmd_termlist(struct http_channel *c)
     const char *nums = http_argbyname(rq, "num");
     int num = 15;
     int status;
-    WRBUF debug_log = wrbuf_alloc();
+    WRBUF debug_log = 0;
 
     if (!s)
         return;
@@ -557,6 +557,8 @@ static void cmd_termlist(struct http_channel *c)
     if (nums)
         num = atoi(nums);
 
+    debug_log = wrbuf_alloc();
+
     wrbuf_rewind(c->wrbuf);
 
     wrbuf_puts(c->wrbuf, "<termlist>\n");