Joe Hinkle - 2009-12-09

When built as a LIB - there are two memory leaks - two strings containing the path and input file.

I solved the issue as follows:

system.c

char *   sharp_filename = NULL; // … hinkle removed static

remove static … I test at exit in main.c and free there

in main.c

fatal_error_exit:
#if MCPP_LIB
    /* Free malloced memory */
    if (mcpp_debug & MACRO_CALL) {
        if (in_file != stdin_name)
{
            free( in_file);
in_file = 0; // hinkle
}

    }

// hinkle
if(in_file)
{
free( in_file);
in_file = 0;
}

if (sharp_filename)
{
free( sharp_filename);
sharp_filename = NULL;
}

// hinkle end

p.s.

The line  if (mcpp_debug & MACRO_CALL) is not TRUE to free … so added code below to free both inline and sharp_filename.

THAT plugs the two leaks.

Enjoy!