crypto: sun8i-ce - fix two error path's memory leak
authorCorentin Labbe <clabbe@baylibre.com>
Sun, 15 Nov 2020 19:08:07 +0000 (19:08 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Dec 2020 10:53:17 +0000 (11:53 +0100)
commit098a597f31150ea6a6d4a3e978bdc3b27212a64d
treec9cb988961ea357887f627c8eb883af06548b67a
parent3cf33a4686c4c7572ef8db3d04b09ccf1ec938ef
crypto: sun8i-ce - fix two error path's memory leak

[ Upstream commit 732b764099f651a088fd931d7b8121b6aa84e62e ]

This patch fixes the following smatch warnings:
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c:412
sun8i_ce_hash_run() warn: possible memory leak of 'result'
Note: "buf" is leaked as well.

Furthermore, in case of ENOMEM, crypto_finalize_hash_request() was not
called which was an error.

Fixes: 56f6d5aee88d ("crypto: sun8i-ce - support hash algorithms")
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Corentin Labbe <clabbe@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c