From bdc0aabbbd9bf440c311c34cda3c49263b0cd8fe Mon Sep 17 00:00:00 2001 From: lyoursly Date: Fri, 20 Sep 2024 15:45:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=A4=E5=A4=84=E6=9C=AA?= =?UTF-8?q?=E9=87=8A=E6=94=BE=E5=86=85=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/bin/pg_dump/common_cipher.cpp | 2 ++ src/bin/psql/common_cipher.cpp | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/bin/pg_dump/common_cipher.cpp b/src/bin/pg_dump/common_cipher.cpp index c5f1696a0..39ff718d7 100644 --- a/src/bin/pg_dump/common_cipher.cpp +++ b/src/bin/pg_dump/common_cipher.cpp @@ -402,12 +402,14 @@ void CryptoModuleParamsCheck(ArchiveHandle* AH, const char* params, const char* rc = memcpy_s((GS_UCHAR*)fout->Key, KEY_MAX_LEN, tmpkey, tmpkeylen); securec_check_c(rc, "\0", "\0"); fout->keylen = tmpkeylen; + OPENSSL_free(tmpkey); } } else if (is_gen_key){ char *encodedley = NULL; symmGenerateKey((ArchiveHandle*)fout); encodedley = SEC_encodeBase64((char*)fout->Key, fout->keylen); write_msg(NULL, "generate key success:%s\n", encodedley); + OPENSSL_free(encodedley); } diff --git a/src/bin/psql/common_cipher.cpp b/src/bin/psql/common_cipher.cpp index fb8e56670..54a8a612f 100644 --- a/src/bin/psql/common_cipher.cpp +++ b/src/bin/psql/common_cipher.cpp @@ -389,7 +389,7 @@ void CryptoModuleParamsCheck(DecryptInfo* pDecryptInfo, const char* params, cons OPENSSL_free(tmpkey); } fprintf(stderr, ("invalid key\n")); - exit(1); + exit(1); } else { rc = memset_s(pDecryptInfo->Key, KEY_MAX_LEN, 0x0, KEY_MAX_LEN); securec_check_c(rc, "\0", "\0"); @@ -397,6 +397,7 @@ void CryptoModuleParamsCheck(DecryptInfo* pDecryptInfo, const char* params, cons rc = memcpy_s((GS_UCHAR*)pDecryptInfo->Key, KEY_MAX_LEN, tmpkey, tmpkeylen); securec_check_c(rc, "\0", "\0"); pDecryptInfo->keyLen = tmpkeylen; + OPENSSL_free(tmpkey); } } else { fprintf(stderr, ("invalid key\n"));