Fix memory leak 26/282626/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.062746 accepted/tizen/7.0/unified/20221207.014408 accepted/tizen/7.0/unified/hotfix/20221116.105159 accepted/tizen/unified/20221007.101821 tizen_7.0_m2_release
authorSeonah Moon <seonah1.moon@samsung.com>
Fri, 7 Oct 2022 01:03:32 +0000 (10:03 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Fri, 7 Oct 2022 01:03:40 +0000 (10:03 +0900)
Change-Id: I1834c3c15f0a7933e6b4cabcf6a5fa5ad7d2979f

src/mobileap_bluetooth.c
src/mobileap_wifi.c

index 877bbdb..092f18f 100755 (executable)
@@ -855,6 +855,7 @@ static void __bt_nap_ipv6_connection_changed(bool connected, const char *remote_
                ret = bt_adapter_get_bonded_device_info(remote_address, &info);
                if (ret != BT_ERROR_NONE) {
                        ERR("bt_adapter_get_bonded_device_info is failed : %d\n", ret);
+                       bt_adapter_free_device_info(info);
                        return;
                }
 
index a490a56..1181ba5 100755 (executable)
@@ -2114,6 +2114,8 @@ gboolean softap_start_recovery()
        int security_type;
        int mode;
        int ret;
+       char *ssid = NULL;
+       char *key = NULL;
        const char *mode_str = NULL;
 
        /* dhcp server start */
@@ -2122,8 +2124,11 @@ gboolean softap_start_recovery()
                return false;
        }
 
-       g_strlcpy(old_settings->ssid, vconf_get_str(VCONFKEY_SOFTAP_SSID),
-                         sizeof(old_settings->ssid));
+       ssid = vconf_get_str(VCONFKEY_SOFTAP_SSID);
+       if (ssid) {
+               g_strlcpy(old_settings->ssid, ssid, sizeof(old_settings->ssid));
+               free(ssid);
+       }
 
        if (vconf_get_int(VCONFKEY_SOFTAP_SECURITY, &security_type) < 0) {
                ERR("failed to get softap_security vconfkey");
@@ -2166,7 +2171,12 @@ gboolean softap_start_recovery()
        }
 
        g_strlcpy(old_settings->mode, mode_str, sizeof(old_settings->mode));
-       g_strlcpy(old_settings->key, vconf_get_str(VCONFKEY_SOFTAP_KEY), sizeof(old_settings->key));
+
+       key = vconf_get_str(VCONFKEY_SOFTAP_KEY);
+       if (key) {
+               g_strlcpy(old_settings->key, key, sizeof(old_settings->key));
+               free(key);
+       }
 
        old_settings->max_sta = MOBILE_AP_MAX_WIFI_STA;