Ticket #2151 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

Memory leak on imcc_compile_buffer_safe() function

Reported by: Felipe Owned by:
Priority: normal Milestone:
Component: imcc Version: master
Severity: medium Keywords:
Cc: Language:
Patch status: new Platform: all

Description

Running valgrind --leak-check=full ./parrot hello.pir is possible to see a memory leak in the imcc_compile_buffer_safe() call.

A simple fix:  https://gist.github.com/1081644

Change History

  Changed 3 years ago by Felipe

in reply to: ↑ description   Changed 3 years ago by jkeenan

Replying to Felipe:

Running valgrind --leak-check=full ./parrot hello.pir is possible to see a memory leak in the imcc_compile_buffer_safe() call. A simple fix:  https://gist.github.com/1081644

diff --git a/compilers/imcc/imcc.l b/compilers/imcc/imcc.l
index 92631e2..7b01b74 100644
--- a/compilers/imcc/imcc.l
+++ b/compilers/imcc/imcc.l
@@ -1351,8 +1351,8 @@ imcc_cleanup_input(ARGMOD(imc_info_t * imcc), PIOHANDLE file,
 {
     if (is_file)
         PIO_CLOSE(imcc->interp, file);
- else
- Parrot_str_free_cstring(source_c);
+
+ Parrot_str_free_cstring(source_c);
 }
 
 INTVAL

Okay, but I'm confused when I see the following at the top of compilers/imcc/imcc.l:

/* ex: set ro ft=c:
 * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
 *
 * This file is generated automatically by the Parrot build process
 * from the file compilers/imcc/imcc.l.
 *
 * Any changes made here will be lost!
 *
*/

This comment does not appear to be true. When I applied the patch, and then configured and built Parrot from scratch, and then called git status, this is what I got:

$ git status
# On branch master
# Changed but not updated:
#   (use "git add <file>..." to update what will be committed)
#
#       modified:   compilers/imcc/imcc.l

... which suggests either that that comment is wrong -- compilers/imcc/imcc.l is in the MANIFEST and is therefore part of the distribution, not a file completely generated by make -- or that I'm missing something.

Can someone clarify?

Thank you very much.

kid51

  Changed 3 years ago by Felipe

Hi, this comment is there because it is intended to be a warning in the imclexer.c file, which is generated through the .l file.

  Changed 3 years ago by Felipe

  • status changed from new to closed
  • resolution set to fixed
Note: See TracTickets for help on using tickets.