From 84b7ffafd287cc5b28e6d6967113e358c076865f Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 10 Mar 2024 16:50:03 +0100 Subject: [PATCH] core: use C++ versions of membuffer in add_to_string Avoid explicit calls to free(). Signed-off-by: Berthold Stoeger --- core/membuffer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/core/membuffer.cpp b/core/membuffer.cpp index 2c0af9f0d..bba68d7b3 100644 --- a/core/membuffer.cpp +++ b/core/membuffer.cpp @@ -309,12 +309,10 @@ void put_quoted(struct membuffer *b, const char *text, int is_attribute, int is_ char *add_to_string_va(char *old, const char *fmt, va_list args) { char *res; - struct membuffer o = { 0 }, n = { 0 }; + struct membufferpp o, n; put_vformat(&n, fmt, args); put_format(&o, "%s\n%s", old ?: "", mb_cstring(&n)); res = strdup(mb_cstring(&o)); - free_buffer(&o); - free_buffer(&n); free((void *)old); return res; }