Branch: Tag:

2019-08-28

2019-08-28 09:34:10 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Fixed memory leak for generators.

Fixes [CID 1452817].

2978:       Pike_compiler->compiler_frame->generator_index = 0;    Pike_compiler->compiler_frame->generator_jumptable = -  xalloc(sizeof(INT32) * (states + (states & 1) + 3)); -  generator_jumptable = xalloc(sizeof(INT32) * (states + (states & 1) + 3)); +  xalloc(2 * sizeof(INT32) * (states + (states & 1) + 3)); +  generator_jumptable = Pike_compiler->compiler_frame->generator_jumptable + +  (states + (states & 1) + 3);       for (e = 0; e < states + (states & 1) + 3; e++) {    generator_jumptable[e] = (INT32)emit1(F_POINTER, 0);
3076:       update_arg(generator_switch, store_constant(Pike_sp - 1, 1, 0));    pop_stack(); +  +  free(Pike_compiler->compiler_frame->generator_jumptable); +  Pike_compiler->compiler_frame->generator_jumptable = NULL;    } else if(Pike_compiler->compiler_frame->recur_label > 0)    {   #ifdef PIKE_DEBUG