Fix T41767: Memory free problem when console area copy fail.

Nice little memleak!

Patch by reporter (randon (Dun Liang)) with minor own cleanup, thanks!
This commit is contained in:
Bastien Montagne 2014-09-10 13:14:29 +02:00
parent 965205d0e2
commit 20d6b792a4
Notes: blender-bot 2023-02-14 10:06:01 +01:00
Referenced by issue #41767, Memory free problem when console area copy fail
1 changed files with 2 additions and 9 deletions

View File

@ -888,7 +888,7 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
{
SpaceConsole *sc = CTX_wm_space_console(C);
DynStr *buf_dyn = BLI_dynstr_new();
DynStr *buf_dyn;
char *buf_str;
ConsoleLine *cl;
@ -897,14 +897,6 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
ConsoleLine cl_dummy = {NULL};
#if 0
/* copy whole file */
for (cl = sc->scrollback.first; cl; cl = cl->next) {
BLI_dynstr_append(buf_dyn, cl->line);
BLI_dynstr_append(buf_dyn, "\n");
}
#endif
if (sc->sel_start == sc->sel_end)
return OPERATOR_CANCELLED;
@ -919,6 +911,7 @@ static int console_copy_exec(bContext *C, wmOperator *UNUSED(op))
return OPERATOR_CANCELLED;
}
buf_dyn = BLI_dynstr_new();
offset -= 1;
sel[0] = offset - sc->sel_end;
sel[1] = offset - sc->sel_start;