From 31d4d9ea8bb2678ea4a3742a7d34e76c0ed86956 Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 22 Jan 2020 14:12:41 -0500 Subject: parse: Add a missing NULL check for trie_insert_mem() --- parse.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parse.c b/parse.c index 38bf654..9f9eabe 100644 --- a/parse.c +++ b/parse.c @@ -429,6 +429,11 @@ static int expr_open(struct parser_state *state, struct expr *expr, const char * bfs_stat_id(&sb, &id); struct trie_leaf *leaf = trie_insert_mem(&cmdline->open_files, id, sizeof(id)); + if (!leaf) { + perror("trie_insert_mem()"); + goto out_close; + } + if (leaf->value) { struct open_file *ofile = leaf->value; expr->cfile = ofile->cfile; -- cgit v1.2.3