From: Sung-jae Park Date: Fri, 17 Sep 2021 04:44:29 +0000 (+0900) Subject: Fixup same manner to previous svace patch X-Git-Tag: accepted/tizen/unified/20210923.012133~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9719134df4ef09bc04c50291dcba165420964e9c;p=platform%2Fcore%2Fml%2Fbeyond.git 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 --- 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;