]> git.dujemihanovic.xyz Git - u-boot.git/commit
test: aes: fix memleak
authorPhilippe Reynes <philippe.reynes@softathome.com>
Thu, 6 Feb 2020 16:12:59 +0000 (17:12 +0100)
committerTom Rini <trini@konsulko.com>
Thu, 13 Feb 2020 15:10:50 +0000 (10:10 -0500)
commit58b209cf6060db60375a2ca9fb21febfae3b8f31
tree2fe511c43fb912e3fd0074750491c16ff5e04e48
parent58fc2b54f5b9102d593f3b98c370b6cbaeb97ac2
test: aes: fix memleak

In the first version, the result of malloc is checked
with ut_assertnonnull. But on a fail, this macro exit
the function, so previously malloc are not freed.

So to avoid a memleak, we don't use ut_assertnonnull,
but simply check the return of malloc. If one has failed,
we freed all the allocated memory and quit the function.

Reported-by: Coverity (CID: 284403)
Reported-by: Coverity (CID: 284404)
Reported-by: Coverity (CID: 284405)
Reported-by: Coverity (CID: 284406)
Reported-by: Coverity (CID: 284407)
Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
test/lib/test_aes.c