Skip to content

Commit

Permalink
Fixed memory freeing on macro usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Fubukimaru committed Jan 7, 2021
1 parent 6718924 commit 2d11b5c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/parser4.l
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void register_macro_parameters();
instr[0] = '\0';
strncat(instr, p4_tmpstr, strlen(p4_tmpstr));
macro_id = get_macro_id(instr);
free(instr);
if (macro_id != -1) { // Macro found
if (verbose >=2) {
fprintf(stderr, "Found macro: %s\n", macro_list[macro_id].name);
Expand Down Expand Up @@ -187,7 +188,6 @@ void register_macro_parameters();
macro_src = add_lines_to_macro(macro_src);
safe_strcat(p4_text, macro_src, P4_TEXT_SIZE, fname_src, -1);
// Free previous code
free(macro_src_tmp);
free(macro_src);
} else {
safe_strcat(p4_text, yytext, P4_TEXT_SIZE, fname_src, -1);
Expand Down

0 comments on commit 2d11b5c

Please sign in to comment.