summaryrefslogtreecommitdiff
path: root/c_src/permdb.c
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2016-05-10 11:41:20 +0200
committerLinus Nordberg <linus@nordu.net>2016-05-10 11:41:20 +0200
commit2a63ac24a6c151b47e64a023965eab57ae9b1493 (patch)
treeaca24fcb3135cbe6fc938917a9590a4e66db3eab /c_src/permdb.c
parented5b1feb5f7280d9054543f8b241fd5ee451ec52 (diff)
Don't follow the NULL pointer.
Diffstat (limited to 'c_src/permdb.c')
-rw-r--r--c_src/permdb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/c_src/permdb.c b/c_src/permdb.c
index 7ad9c61..b3e17b6 100644
--- a/c_src/permdb.c
+++ b/c_src/permdb.c
@@ -433,6 +433,10 @@ permdb_alloc(const char *dbpath)
}
permdb_object *state = malloc(sizeof(permdb_object));
+ if (state == NULL) {
+ return NULL;
+ }
+
state->datafile = bf_open(dbpath, O_RDWR|O_CREAT, "datafile");
state->indexfile = bf_open(idxpath, O_RDWR|O_CREAT, "indexfile");