summaryrefslogtreecommitdiff
path: root/lib/mbedtls/pkcs7_parser.c
diff options
context:
space:
mode:
authorRaymond Mao <raymond.mao@linaro.org>2024-10-16 16:48:26 -0700
committerTom Rini <trini@konsulko.com>2024-10-18 14:18:12 -0600
commit7f453771528160f0401a8cb7cd871c32e56f63f2 (patch)
tree5fe3ed54d0b7b869b6ec4ec5c887f562053f093d /lib/mbedtls/pkcs7_parser.c
parentb92a18e2b61ac3de27c24a4c1ed8e01920d7ae4e (diff)
mbedtls: fix defects in coverity scan
Fixes of unreleased buffer, deadcode and wrong variable type detected by coverity scan. Addresses-Coverity-ID: 510809: Resource leaks (RESOURCE_LEAK) Addresses-Coverity-ID: 510806: Control flow issues (DEADCODE) Addresses-Coverity-ID: 510794 Control flow issues (NO_EFFECT) Signed-off-by: Raymond Mao <raymond.mao@linaro.org>
Diffstat (limited to 'lib/mbedtls/pkcs7_parser.c')
-rw-r--r--lib/mbedtls/pkcs7_parser.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/mbedtls/pkcs7_parser.c b/lib/mbedtls/pkcs7_parser.c
index 69ca784858e..ecfcc46edfa 100644
--- a/lib/mbedtls/pkcs7_parser.c
+++ b/lib/mbedtls/pkcs7_parser.c
@@ -206,9 +206,6 @@ static int authattrs_parse(struct pkcs7_message *msg, void *aa, size_t aa_len,
p += seq_len;
}
- if (ret && ret != MBEDTLS_ERR_ASN1_OUT_OF_DATA)
- return ret;
-
msg->have_authattrs = true;
/*
@@ -361,8 +358,10 @@ static int x509_populate_sinfo(struct pkcs7_message *msg,
signed_info->sig = s;
/* Save the Authenticate Attributes data if exists */
- if (!mb_sinfo->authattrs.data || !mb_sinfo->authattrs.data_len)
+ if (!mb_sinfo->authattrs.data || !mb_sinfo->authattrs.data_len) {
+ kfree(mctx);
goto no_authattrs;
+ }
mctx->authattrs_data = kmemdup(mb_sinfo->authattrs.data,
mb_sinfo->authattrs.data_len,