diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-20 19:37:13 -0400 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-09-20 19:37:13 -0400 |
commit | 944512372b71c0a03639264896e791d80e3b0143 (patch) | |
tree | 2b407070d3ea6aae7a810c88a0dd9c129963a3a6 /pc.y | |
parent | b0fa80e34881152350d3994eb1d28687d4d47d84 (diff) |
Fix removes some string duplication
Diffstat (limited to 'pc.y')
-rw-r--r-- | pc.y | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -2,6 +2,7 @@ #include <stdlib.h> #include <stddef.h> #include <assert.h> +#include <string.h> #include "node.h" #include "scope.h" @@ -201,7 +202,9 @@ sub_prog_head tmp->var_type = $5; - cur_scope->ret_var = scope_insert(cur_scope, $2); + /* Need to duplicate ID.name so it is not freed with inner + * scope*/ + cur_scope->ret_var = scope_insert(cur_scope, strdup($2)); cur_scope->ret_var->var_type = $5; } |PROC ID arguments ';' |