fix memory leak in asc_text_printf()

Sun, 06 Oct 2024 19:45:34 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 06 Oct 2024 19:45:34 +0200
changeset 74
25fb39f8863a
parent 73
cfa1d05754ac
child 75
0ce353485509

fix memory leak in asc_text_printf()

src/text.c file | annotate | diff | comparison | revisions
--- a/src/text.c	Sun Oct 06 19:43:08 2024 +0200
+++ b/src/text.c	Sun Oct 06 19:45:34 2024 +0200
@@ -113,10 +113,14 @@
         char const* format,
         ...
 ) {
-    cxmutstr text = ((AscText*)node)->text;
     va_list ap;
     va_start(ap, format);
-    cx_vsprintf(&text.ptr, &text.length, format, ap);
+    cx_vsprintf(
+            &(((AscText*)node)->text.ptr),
+            &(((AscText*)node)->text.length),
+            format,
+            ap
+    );
     va_end(ap);
     asc_node_update(node);
 }

mercurial