Use inline function ds_clear to reset dstring memory.

Add dc_free to free dstring memory, avoid memory leak.
This commit is contained in:
Holger Vogt 2023-04-05 16:14:49 +02:00
parent 9551cf0b59
commit dc6c232418
1 changed files with 2 additions and 4 deletions

View File

@ -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);
}