Use inline function ds_clear to reset dstring memory.
Add dc_free to free dstring memory, avoid memory leak.
This commit is contained in:
parent
9551cf0b59
commit
dc6c232418
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue