summaryrefslogtreecommitdiff
path: root/c_src
diff options
context:
space:
mode:
Diffstat (limited to 'c_src')
-rw-r--r--c_src/Makefile2
-rw-r--r--c_src/permdb.c5
2 files changed, 5 insertions, 2 deletions
diff --git a/c_src/Makefile b/c_src/Makefile
index 9a6c0a4..c7e1367 100644
--- a/c_src/Makefile
+++ b/c_src/Makefile
@@ -38,7 +38,7 @@ permdbtest_OBJS = permdb.o arlamath.o hash.o permdbtest.o $(common_OBJS)
all: $(PORTS) $(OTHER_BIN)
clean:
- rm -f $(fsynchelper_OBJS) $(hsmhelper_OBJS) $(permdbport_OBJS) $(permdbso_OBJS) $(permdbtest_OBJS) $(PORTS)
+ rm -f $(fsynchelper_OBJS) $(hsmhelper_OBJS) $(permdbport_OBJS) $(permdbso_OBJS) $(permdbtest_OBJS) $(PORTS) $(OTHER_BIN)
fsynchelper: $(fsynchelper_OBJS)
$(CC) -o fsynchelper $(fsynchelper_OBJS) $(LDFLAGS)
diff --git a/c_src/permdb.c b/c_src/permdb.c
index a4344a0..4b3a6ef 100644
--- a/c_src/permdb.c
+++ b/c_src/permdb.c
@@ -577,18 +577,21 @@ permdb_alloc(const char *dbpath)
} else if (state->datafile.filesize > 0 && state->indexfile.filesize == 0) {
if (rebuild_index_file(state) < 0) {
warnx("index file rebuilding failed");
+ permdb_free(state);
return NULL;
}
}
if (datafile_verify_file(&state->datafile) < 0) {
warnx("data file verification failed");
- return NULL;
+ permdb_free(state);
+ return NULL;
}
if (indexfile_verify_file(&state->indexfile) < 0) {
warnx("index file verification failed, rebuilding");
if (rebuild_index_file(state) < 0) {
warnx("index file rebuilding failed");
+ permdb_free(state);
return NULL;
}
}