From 9719134df4ef09bc04c50291dcba165420964e9c Mon Sep 17 00:00:00 2001 From: Sung-jae Park Date: Fri, 17 Sep 2021 13:44:29 +0900 Subject: [PATCH] Fixup same manner to previous svace patch [Problem] There was a svace alert for the resource leak [Solution] Fixup like what the previous patch did * This and previous patch is not possible to happen However, for the safe-coding, applies this patch too Change-Id: I44d86a280d184287f6025e763b8d2d2a55cedcdf Signed-off-by: Sung-jae Park --- subprojects/libbeyond-authenticator_ssl/src/authenticator.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/subprojects/libbeyond-authenticator_ssl/src/authenticator.cc b/subprojects/libbeyond-authenticator_ssl/src/authenticator.cc index be09c38..dad0dae 100644 --- a/subprojects/libbeyond-authenticator_ssl/src/authenticator.cc +++ b/subprojects/libbeyond-authenticator_ssl/src/authenticator.cc @@ -1062,8 +1062,8 @@ int Authenticator::Crypto(int opid, beyond_authenticator_key_id id, const void * } if (opid == CRYPTO_OP::ENCRYPT && sslConfig.enableBase64 == true) { - char *_output; - int _outputSize; + char *_output = nullptr; + int _outputSize = 0; ret = EncodeBase64(_output, _outputSize, static_cast(out), outlen); free(out); out = nullptr; @@ -1074,6 +1074,7 @@ int Authenticator::Crypto(int opid, beyond_authenticator_key_id id, const void * break; } else if (_output == nullptr || _outputSize <= 0) { ErrPrint("Invalid encoded data"); + free(_output); delete output; output = nullptr; ret = -EINVAL; -- 2.7.4