summaryrefslogtreecommitdiff
path: root/src/del.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/del.c')
-rw-r--r--src/del.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/del.c b/src/del.c
index 7d4a443..df452b1 100644
--- a/src/del.c
+++ b/src/del.c
@@ -46,6 +46,9 @@ static int del_main(void *ctx, int argc, char **argv)
}
state = apk_state_new(&db);
+ if (state == NULL)
+ goto err;
+
for (i = 0; i < argc; i++) {
struct apk_dependency dep;
@@ -63,7 +66,8 @@ static int del_main(void *ctx, int argc, char **argv)
}
r = apk_state_commit(state, &db);
err:
- apk_state_unref(state);
+ if (state != NULL)
+ apk_state_unref(state);
out:
apk_db_close(&db);