From f85d87e5f9d0572bbb04ecb9aaad47f9c15b1703 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 7 Jun 2010 17:45:04 +0300 Subject: db: fix usage of apk_name_array in install_ctx got broken to the previous array cleanup and grepping struct definition only from headers. --- src/database.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/database.c b/src/database.c index 2e886c2..7421e1b 100644 --- a/src/database.c +++ b/src/database.c @@ -1753,10 +1753,10 @@ static int apk_db_install_archive_entry(void *_ctx, if (opkg->name == pkg->name) break; /* Overwriting with permission? */ - for (i = 0; ctx->replaces && i < ctx->replaces->num; i++) + for (i = 0; i < ctx->replaces->num; i++) if (opkg->name == ctx->replaces->item[i]) break; - if (ctx->replaces && i < ctx->replaces->num) + if (i < ctx->replaces->num) break; if (!(apk_flags & APK_FORCE)) { @@ -2027,13 +2027,13 @@ static int apk_db_unpack_pkg(struct apk_database *db, .cb = cb, .cb_ctx = cb_ctx, }; + apk_name_array_init(&ctx.replaces); apk_sign_ctx_init(&ctx.sctx, APK_SIGN_VERIFY_IDENTITY, &pkg->csum, db->keys_fd); tar = apk_bstream_gunzip_mpart(bs, apk_sign_ctx_mpart_cb, &ctx.sctx); r = apk_tar_parse(tar, apk_db_install_archive_entry, &ctx, TRUE); apk_sign_ctx_free(&ctx.sctx); + apk_name_array_free(&ctx.replaces); tar->close(tar); - if (ctx.replaces) - free(ctx.replaces); if (need_copy) { if (r == 0) -- cgit v1.2.3-60-g2f50