Memory Leak in RegExp
M-Tarasov opened this issue · comments
Following JavaScript code produces a memory leak:
if("foo".match(/foo/))
print("ok");
==13451== 2,440 (24 direct, 2,416 indirect) bytes in 1 blocks are definitely lost in loss record 3 of 3
==13451== at 0x4C28BED: malloc (vg_replace_malloc.c:263)
==13451== by 0x40982B: v7_create_regexp (v7.c:5934)
==13451== by 0x41409D: i_eval_expr (v7.c:8907)
==13451== by 0x415877: i_eval_call (v7.c:9300)
==13451== by 0x4143AA: i_eval_expr (v7.c:8950)
==13451== by 0x415ED0: i_eval_stmt (v7.c:9406)
==13451== by 0x415BEE: i_eval_stmts (v7.c:9371)
==13451== by 0x415E27: i_eval_stmt (v7.c:9399)
==13451== by 0x417CF9: v7_exec_with (v7.c:9917)
==13451== by 0x417DA5: v7_exec (v7.c:9931)
==13451== by 0x417F92: v7_exec_file (v7.c:9960)
==13451== by 0x42250B: main (main.c:43)
within a simple program:
int main(int argc, char* argv[])
{
struct v7 *v7 = v7_create();
v7_val_t res;
v7_exec_file(v7, &res, argv[1]);
v7_destroy(v7);
return 0;
}
we fixed a lot of things since the beta release. Could you please try out the current HEAD ?
The v7_exec_* signature also changed.
In master's HEAD there is no memory leak at this place anymore