From: Jaehyun Kim Date: Wed, 13 Jul 2022 02:51:16 +0000 (+0900) Subject: Fix memory issues in unittest code X-Git-Tag: accepted/tizen/7.0/unified/20221110.062008^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F59%2F277759%2F1;p=platform%2Fcore%2Fapi%2Fconnection.git Fix memory issues in unittest code Change-Id: Ifbac73ef284ce1fd96c7097356b5aa52c57fd2ba Signed-off-by: Jaehyun Kim --- diff --git a/unittest/tct-connection-core.cpp b/unittest/tct-connection-core.cpp index 674372a..6de1c5a 100755 --- a/unittest/tct-connection-core.cpp +++ b/unittest/tct-connection-core.cpp @@ -79,6 +79,7 @@ TEST(connection, connection){ } else { PRINT_LOG(DLOG_INFO, "NativeTCT", "Name check error! [%s][%s]", pszGetTCName, tc_array[i].name); + FREE_MEMORY_TC(pszGetTCName); ASSERT_EQ(0, 1); } if (COMMON_DEBUG) diff --git a/unittest/utc-connection-profile.c b/unittest/utc-connection-profile.c index 28fa478..bebc587 100755 --- a/unittest/utc-connection-profile.c +++ b/unittest/utc-connection-profile.c @@ -1989,7 +1989,10 @@ int utc_connection_profile_get_cellular_auth_info_p(void) char *pwd = NULL; int ret = connection_profile_get_cellular_auth_info(profile_cellular, &type, &name, &pwd); - FREE_RESOURCE(name); FREE_RESOURCE(pwd); + if (ret == CONNECTION_ERROR_NONE) { + FREE_RESOURCE(name); + FREE_RESOURCE(pwd); + } if (telephony_supported) CHECK_RETURN("connection_profile_get_cellular_auth_info", ret, CONNECTION_ERROR_NONE);