From 5db59eb641e68826b9521a62cd992a6fdcfc940e Mon Sep 17 00:00:00 2001 From: shikai-123 Date: Mon, 21 Feb 2022 09:12:01 +0800 Subject: [PATCH] Signed-off-by: shikai-123 Modify defects of util --- util/js_base64.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/util/js_base64.cpp b/util/js_base64.cpp index 7f8e80f..8a91ee2 100755 --- a/util/js_base64.cpp +++ b/util/js_base64.cpp @@ -284,16 +284,14 @@ namespace OHOS::Util { /* Memory cleanup function */ void Base64::FreeMemory(unsigned char *address) { - unsigned char *temp = address; - if (temp != nullptr) { + if (address != nullptr) { delete[] temp; temp = nullptr; } } void Base64::FreeMemory(char *address) { - char *temp = address; - if (temp != nullptr) { + if (address != nullptr) { delete[] temp; temp = nullptr; } @@ -601,8 +599,7 @@ namespace OHOS::Util { void FreeMemory(unsigned char *address) { - unsigned char *temp = address; - if (temp != nullptr) { + if (address != nullptr) { delete[] temp; temp = nullptr; }