From dc6c23241830f42793c1a4161e3bc88207924b48 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Wed, 5 Apr 2023 16:14:49 +0200 Subject: [PATCH] Use inline function ds_clear to reset dstring memory. Add dc_free to free dstring memory, avoid memory leak. --- src/frontend/inpcom.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index e0127119f..c7563db66 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -790,10 +790,7 @@ static void inp_stitch_continuation_lines_dstring(struct card* working) if (!firsttime) { tfree(prev->line); prev->line = copy(ds_get_buf(&newline)); - /* reset newline, but keep memory already allocated */ - newline.length = 0; - newline.p_buf[0] = '\0'; - newline.p_stack_buf[0] = '\0'; + ds_clear(&newline); firsttime = TRUE; } prev = working; @@ -801,6 +798,7 @@ static void inp_stitch_continuation_lines_dstring(struct card* working) break; } } + ds_free(&newline); }