summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-01-22 14:12:41 -0500
committerTavian Barnes <tavianator@tavianator.com>2020-01-22 14:13:02 -0500
commit31d4d9ea8bb2678ea4a3742a7d34e76c0ed86956 (patch)
tree1ed1cc22ee39fd70e0474f8b291bd25639639997 /parse.c
parent9c9b5aa26ff316c1cbe09fbdd0d254f06ac7190d (diff)
downloadbfs-31d4d9ea8bb2678ea4a3742a7d34e76c0ed86956.tar.xz
parse: Add a missing NULL check for trie_insert_mem()
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c5
1 files changed, 5 insertions, 0 deletions
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;