Fix memory leak 94/296694/1
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 3 Aug 2023 06:47:00 +0000 (15:47 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Thu, 3 Aug 2023 06:47:00 +0000 (15:47 +0900)
This patch fixes the following case:
+------------------------------------------------------------------------------+
  25 bytes in 1 blocks are definitely lost in loss record 1,476 of 3,015
  ==513==    at 0x4848A14: malloc (vg_replace_malloc.c:307)
  ==513==    by 0x49C6F77: strdup (strdup.c:42)
  ==513==    by 0x4C46F97: vconf_get_str (vconf.c:1203)
  ==513==    by 0x48EB983: amd::AppStatusManager::InitVconf()
                           (app_status_manager.cc:901)
  ==513==    by 0x48EBACF: amd::AppStatusManager::Init()::{lambda(void*)#4}::
                           _FUN(void*) (app_status_manager.cc:1061)
  ==513==    by 0x4B8D247: g_timeout_dispatch (gmain.c:4933)
  ==513==    by 0x4B8C8EB: g_main_dispatch (gmain.c:3381)
  ==513==    by 0x4B8C8EB: g_main_context_dispatch (gmain.c:4099)
  ==513==    by 0x4B8CB6F: g_main_context_iterate.isra.0 (gmain.c:4175)
  ==513==    by 0x4B8CDD7: g_main_loop_run (gmain.c:4373)
  ==513==    by 0x48B7D79: amd_main (amd_main.cc:282)
+------------------------------------------------------------------------------+

Change-Id: Icdb2f3b294e12d794d877f040f768e7991fa0d4e
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/lib/app_status/app_status_manager.cc

index fe2057a..1c061cf 100644 (file)
@@ -907,6 +907,7 @@ int AppStatusManager::InitVconf() {
   }
 
   home_appid_ = buf;
+  free(buf);
   ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_SELECTED_PACKAGE_NAME,
       VconfSetHomeAppCallback, this);
   if (ret != VCONF_OK) {