naynajain / mbedtls-1

An open source, portable, easy to use, readable and flexible SSL library
https://tls.mbed.org
Apache License 2.0
1 stars 2 forks source link

pkcs7.c: Close file if alloc fails #12

Closed nick-child-ibm closed 3 years ago

nick-child-ibm commented 3 years ago

The static analysis tool cppcheck will show that the function mbedtls_pkcs7_load_file does not properly close the opened file if memory allocation fails for the data buf. This commit ensures that, if a memory allocation error does occur, the opened file will be closed before returning.

Signed-off-by: Nick Child nick.child@ibm.com