Skip to content

Commit b75af93

Browse files
authored
Merge pull request #9278 from JacobBarthelmeh/pkcs7_stream
coverity warnings on test case, CID 549270 and 549271
2 parents b3031d2 + 1237a54 commit b75af93

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/api/test_pkcs7.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2163,10 +2163,10 @@ int test_wc_PKCS7_DecodeEnvelopedData_multiple_recipients(void)
21632163
byte decodedData[8192];
21642164

21652165
ExpectTrue((f = XFOPEN(testFile, "rb")) != XBADFILE);
2166-
testDerBufferSz = XFREAD(testDerBuffer, 1,
2167-
sizeof(testDerBuffer), f);
2168-
ExpectIntNE(testDerBufferSz, 0);
21692166
if (f != XBADFILE) {
2167+
testDerBufferSz = XFREAD(testDerBuffer, 1,
2168+
sizeof(testDerBuffer), f);
2169+
ExpectIntGT(testDerBufferSz, 0);
21702170
XFCLOSE(f);
21712171
f = XBADFILE;
21722172
}
@@ -2188,6 +2188,7 @@ int test_wc_PKCS7_DecodeEnvelopedData_multiple_recipients(void)
21882188
ExpectIntGT(ret, 0);
21892189
#endif
21902190
wc_PKCS7_Free(pkcs7);
2191+
pkcs7 = NULL;
21912192
}
21922193

21932194
/* test with client cert recipient */
@@ -2207,6 +2208,7 @@ int test_wc_PKCS7_DecodeEnvelopedData_multiple_recipients(void)
22072208
ExpectIntGT(ret, 0);
22082209
#endif
22092210
wc_PKCS7_Free(pkcs7);
2211+
pkcs7 = NULL;
22102212
}
22112213

22122214
/* test with ca cert recipient (which should fail) */
@@ -2222,6 +2224,7 @@ int test_wc_PKCS7_DecodeEnvelopedData_multiple_recipients(void)
22222224
(word32)testDerBufferSz, decodedData, sizeof(decodedData));
22232225
ExpectIntLT(ret, 0);
22242226
wc_PKCS7_Free(pkcs7);
2227+
pkcs7 = NULL;
22252228
}
22262229

22272230
return EXPECT_RESULT();

0 commit comments

Comments
 (0)