summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomas Mraz <tomas@openssl.org>2023-06-07 14:28:58 +0200
committerTodd Short <todd.short@me.com>2023-06-10 19:23:59 -0400
commitef1ed411e1d526cdf6b87613d1b6021ab07d0f2e (patch)
treedd540b4c60d2c6f8a9d3f5acb2d43562f5aa16db
parent265920f2a78ff295264824b5d8294dd45173ae42 (diff)
Coverity 1528486: Avoid assignment of unused value of bags
It is used only within the loop and always initialized
-rw-r--r--apps/pkcs12.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/pkcs12.c b/apps/pkcs12.c
index 823d97085d..857a2a10c0 100644
--- a/apps/pkcs12.c
+++ b/apps/pkcs12.c
@@ -899,7 +899,6 @@ int dump_certs_keys_p12(BIO *out, const PKCS12 *p12, const char *pass,
const EVP_CIPHER *enc)
{
STACK_OF(PKCS7) *asafes = NULL;
- STACK_OF(PKCS12_SAFEBAG) *bags;
int i, bagnid;
int ret = 0;
PKCS7 *p7;
@@ -907,6 +906,8 @@ int dump_certs_keys_p12(BIO *out, const PKCS12 *p12, const char *pass,
if ((asafes = PKCS12_unpack_authsafes(p12)) == NULL)
return 0;
for (i = 0; i < sk_PKCS7_num(asafes); i++) {
+ STACK_OF(PKCS12_SAFEBAG) *bags;
+
p7 = sk_PKCS7_value(asafes, i);
bagnid = OBJ_obj2nid(p7->type);
if (bagnid == NID_pkcs7_data) {
@@ -922,7 +923,7 @@ int dump_certs_keys_p12(BIO *out, const PKCS12 *p12, const char *pass,
} else {
continue;
}
- if (!bags)
+ if (bags == NULL)
goto err;
if (!dump_certs_pkeys_bags(out, bags, pass, passlen,
options, pempass, enc)) {
@@ -930,7 +931,6 @@ int dump_certs_keys_p12(BIO *out, const PKCS12 *p12, const char *pass,
goto err;
}
sk_PKCS12_SAFEBAG_pop_free(bags, PKCS12_SAFEBAG_free);
- bags = NULL;
}
ret = 1;