3 | | if (IMCC_INFO(interp)->error_code) { |
4 | | char * const error_str = Parrot_str_to_cstring(interp, |
5 | | IMCC_INFO(interp)->error_message); |
| 7 | IMCC_INFO(interp)->error_code=IMCC_FATAL_EXCEPTION;[[BR]] |
| 8 | fprintf(stderr, "error:imcc:%s", error_str);[[BR]] |
| 9 | IMCC_print_inc(interp);[[BR]] |
| 10 | Parrot_str_free_cstring(error_str);[[BR]] |
| 11 | Parrot_x_exit(interp, IMCC_FATAL_EXCEPTION);[[BR]] |
| 12 | }[[BR]] |
| 13 | imc_cleanup(interp, yyscanner);[[BR]] |
| 14 | [[BR]] |
| 15 | In the error branch main.c is not calling imc_cleanup so valgrind gives the following output:[[BR]] |
7 | | IMCC_INFO(interp)->error_code=IMCC_FATAL_EXCEPTION; |
8 | | fprintf(stderr, "error:imcc:%s", error_str); |
9 | | IMCC_print_inc(interp); |
10 | | Parrot_str_free_cstring(error_str); |
11 | | Parrot_x_exit(interp, IMCC_FATAL_EXCEPTION); |
12 | | } |
13 | | imc_cleanup(interp, yyscanner); |
14 | | |
15 | | In the error branch main.c is not calling imc_cleanup so valgrind gives the following output: |
16 | | |
17 | | ==4322== 222 (208 direct, 14 indirect) bytes in 1 blocks are definitely lost in loss record 238 of 508 |
18 | | ==4322== at 0x4C27480: calloc (vg_replace_malloc.c:467) |
19 | | ==4322== by 0x4FB05F7: gc_ms2_allocate_memory_chunk_zeroed (gc_ms2.c:1410) |
20 | | ==4322== by 0x4FA9EC5: Parrot_gc_allocate_memory_chunk_with_interior_pointers (api.c:628) |
21 | | ==4322== by 0x50FEE0C: new_frame (imcc.l:752) |
22 | | ==4322== by 0x5100397: IMCC_push_parser_state (imcc.l:1263) |
23 | | ==4322== by 0x5102552: compile_to_bytecode (main.c:556) |
24 | | ==4322== by 0x51029C4: imcc_run (main.c:652) |
25 | | ==4322== by 0x401313: main (main.c:152) |
| 17 | ==4322== 222 (208 direct, 14 indirect) bytes in 1 blocks are definitely lost in loss record 238 of 508[[BR]] |
| 18 | ==4322== at 0x4C27480: calloc (vg_replace_malloc.c:467)[[BR]] |
| 19 | ==4322== by 0x4FB05F7: gc_ms2_allocate_memory_chunk_zeroed (gc_ms2.c:1410)[[BR]] |
| 20 | ==4322== by 0x4FA9EC5: Parrot_gc_allocate_memory_chunk_with_interior_pointers (api.c:628)[[BR]] |
| 21 | ==4322== by 0x50FEE0C: new_frame (imcc.l:752)[[BR]] |
| 22 | ==4322== by 0x5100397: IMCC_push_parser_state (imcc.l:1263)[[BR]] |
| 23 | ==4322== by 0x5102552: compile_to_bytecode (main.c:556)[[BR]] |
| 24 | ==4322== by 0x51029C4: imcc_run (main.c:652)[[BR]] |
| 25 | ==4322== by 0x401313: main (main.c:152)[[BR]] |