Fix memory issues in unittest code 59/277759/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.062008 accepted/tizen/7.0/unified/hotfix/20221116.104626 accepted/tizen/unified/20220714.135350 submit/tizen/20220713.054123 tizen_7.0_m2_release
authorJaehyun Kim <jeik01.kim@samsung.com>
Wed, 13 Jul 2022 02:51:16 +0000 (11:51 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Wed, 13 Jul 2022 02:52:58 +0000 (11:52 +0900)
Change-Id: Ifbac73ef284ce1fd96c7097356b5aa52c57fd2ba
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
unittest/tct-connection-core.cpp
unittest/utc-connection-profile.c

index 674372a..6de1c5a 100755 (executable)
@@ -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)
index 28fa478..bebc587 100755 (executable)
@@ -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);