Set a target string to a proper address 60/282460/1 accepted/tizen_7.0_unified_hotfix tizen_7.0_hotfix accepted/tizen/7.0/unified/20221110.063400 accepted/tizen/7.0/unified/hotfix/20221116.104302 accepted/tizen/unified/20221005.023213 submit/tizen/20221004.080513 tizen_7.0_m2_release
authorJin Yoon <jinny.yoon@samsung.com>
Tue, 4 Oct 2022 05:00:42 +0000 (14:00 +0900)
committerJin Yoon <jinny.yoon@samsung.com>
Tue, 4 Oct 2022 05:01:05 +0000 (14:01 +0900)
Change-Id: Ib8a09494fddd6b0468ec21e06480e3caa3ceb295

src/status.c

index a4cc44d..3262050 100755 (executable)
@@ -79,7 +79,7 @@ static inline void _call_callback(status_active_key_e key)
        }
 }
 
-static inline void _set_str_with_default(keynode_t* node, const char *def, char *target)
+static inline void _set_str_with_default(keynode_t* node, const char *def, char **target)
 {
        const char *key_str = vconf_keynode_get_str(node);
        char *str = NULL;
@@ -92,8 +92,10 @@ static inline void _set_str_with_default(keynode_t* node, const char *def, char
        if (!str)
                _E("failed to strdup, keep old one");
 
-       free(target);
-       target = str;
+       free(*target);
+       *target = str;
+
+       _D("Target string is %s", *target);
 }
 
 static void _pm_state_cb(keynode_t* node, void *data)
@@ -109,7 +111,7 @@ static void _setappl_select_pkg_cb(keynode_t* node, void *data)
 
        char *fallback_pkg = vconf_get_str(VCONFKEY_STARTER_FALLBACK_PKG);
        _set_str_with_default(node, fallback_pkg,
-               s_status_active.setappl_selected_package_name);
+               &s_status_active.setappl_selected_package_name);
        if (!s_status_active.setappl_selected_package_name)
                _E("Package name is NULL");
 
@@ -251,7 +253,7 @@ static void _setappl_3rd_lock_pkg_name_cb(keynode_t* node, void *data)
 {
        ret_if(!node);
        _set_str_with_default(node, STATUS_DEFAULT_LOCK_PKG_NAME,
-               s_status_passive.setappl_3rd_lock_pkg_name_str);
+               &s_status_passive.setappl_3rd_lock_pkg_name_str);
        if (!s_status_passive.setappl_3rd_lock_pkg_name_str)
                _E("Package name is NULL");
 }