From 559556dc6cb4bd025da4b6855f54162baab9b249 Mon Sep 17 00:00:00 2001 From: ame Date: Tue, 27 Feb 2024 09:57:26 -0600 Subject: cookies, clean memeory --- src/util.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/util.c') diff --git a/src/util.c b/src/util.c index 4ba0476..f1b9881 100644 --- a/src/util.c +++ b/src/util.c @@ -27,8 +27,11 @@ int gen_parse(char* inp, int len, parray_t** _table){ state = 0; } else if(current->c[0] != '\0' || inp[i] != ' ') str_pushl(current, inp + i, 1); } - parray_set(table, last->c, (void*)current); - str_free(last); + + if(last != NULL){ + parray_set(table, last->c, (void*)current); + str_free(last); + } *_table = table; return 1; } -- cgit v1.2.3