summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2009-05-11 12:17:35 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2009-05-11 12:17:35 +0000
commitade18415414b49a7e78ac7c8b1a6c81cd81bb1a1 (patch)
treeb10f3d29ae2119ebc88057246357d495193d38f1
parent110611c53c8e1b09c27c8c516c7f7c0baf47f68b (diff)
downloadapk-tools-ade18415414b49a7e78ac7c8b1a6c81cd81bb1a1.tar.gz
apk-tools-ade18415414b49a7e78ac7c8b1a6c81cd81bb1a1.tar.bz2
apk-tools-ade18415414b49a7e78ac7c8b1a6c81cd81bb1a1.tar.xz
apk-tools-ade18415414b49a7e78ac7c8b1a6c81cd81bb1a1.zip
fix misc compiler warnings about unintialized variables.
The compiler is actually right about those.
-rw-r--r--src/add.c5
-rw-r--r--src/del.c2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/add.c b/src/add.c
index 9efab15..5e7e95f 100644
--- a/src/add.c
+++ b/src/add.c
@@ -40,7 +40,7 @@ static int add_main(void *ctx, int argc, char **argv)
{
struct add_ctx *actx = (struct add_ctx *) ctx;
struct apk_database db;
- struct apk_state *state;
+ struct apk_state *state = NULL;
struct apk_dependency_array *pkgs; /* list of pkgs to install */
int i, r;
@@ -86,7 +86,8 @@ static int add_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);
apk_db_close(&db);
return r;
}
diff --git a/src/del.c b/src/del.c
index deafeff..2a07eee 100644
--- a/src/del.c
+++ b/src/del.c
@@ -19,7 +19,7 @@ static int del_main(void *ctx, int argc, char **argv)
struct apk_database db;
struct apk_state *state;
struct apk_name *name;
- int i, r;
+ int i, r = 0;
if (apk_db_open(&db, apk_root, APK_OPENF_WRITE) < 0)
return -1;