diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2020-01-22 14:12:41 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2020-01-22 14:13:02 -0500 |
commit | 31d4d9ea8bb2678ea4a3742a7d34e76c0ed86956 (patch) | |
tree | 1ed1cc22ee39fd70e0474f8b291bd25639639997 /parse.c | |
parent | 9c9b5aa26ff316c1cbe09fbdd0d254f06ac7190d (diff) | |
download | bfs-31d4d9ea8bb2678ea4a3742a7d34e76c0ed86956.tar.xz |
parse: Add a missing NULL check for trie_insert_mem()
Diffstat (limited to 'parse.c')
-rw-r--r-- | parse.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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; |