From 7605f2254536db2052690f0b91ff8110ab8a6828 Mon Sep 17 00:00:00 2001 From: Tucker Evans Date: Sat, 28 Sep 2019 23:02:04 -0400 Subject: Fix invalid freeing of read/write functions Function names must be strdup from constants so the strings can later be freed when the scope is popped. --- pc.l | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pc.l b/pc.l index 701e469..ef4fbb0 100644 --- a/pc.l +++ b/pc.l @@ -36,7 +36,7 @@ id [A-Za-z][A-Za-z0-9_]* input { node *tmp; - tmp = scope_insert(cur_scope, "write"); + tmp = scope_insert(cur_scope, strdup("write")); tmp->func_info = malloc(sizeof(struct fi)); return IO; @@ -44,7 +44,7 @@ input { output { node *tmp; - tmp = scope_insert(cur_scope, "read"); + tmp = scope_insert(cur_scope, strdup("read")); tmp->func_info = malloc(sizeof(struct fi)); return IO; -- cgit v1.1