Fix Coverity issue(Resource leak) 31/317831/1 accepted/tizen_unified_dev accepted/tizen/unified/20240920.050202 accepted/tizen/unified/dev/20240924.080617 accepted/tizen/unified/toolchain/20241004.101913 accepted/tizen/unified/x/20240920.102413 accepted/tizen/unified/x/asan/20241014.000254
authorGilbok Lee <gilbok.lee@samsung.com>
Thu, 19 Sep 2024 06:25:46 +0000 (15:25 +0900)
committerGilbok Lee <gilbok.lee@samsung.com>
Thu, 19 Sep 2024 06:25:46 +0000 (15:25 +0900)
[Version] 0.1.1
[Issue Type] Fix bugs

Change-Id: I023bbddd3854c5641751ba9509590cf9ad0d5f1a

packaging/libtrackrenderer.spec
src/resourcemanager.cpp

index 70c7423..d3d7227 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libtrackrenderer
 Summary:    new multimedia streaming player trackrenderer
-Version:    0.1.0
+Version:    0.1.1
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 4f62611..c4d21c6 100644 (file)
@@ -59,19 +59,18 @@ rm_rsc_category_e GetCategoryID(const ResourceProperty& property) {
 }
 
 bool GetAppIdByPid(int pid, std::string& name) {
-  gchar *con;
-
+  g_autofree gchar *con = NULL;
   g_autoptr(GError) error = NULL;
 
-  auto cmdline = g_strdup_printf("/proc/%d/cmdline", pid);
+  g_autofree gchar *cmdline = g_strdup_printf("/proc/%d/cmdline", pid);
   if (!g_file_get_contents(cmdline, &con, NULL, &error)) {
     TRACKRENDERER_ERROR("error : %s", error->message);
     return false;
   }
 
-  name = g_path_get_basename(con);
+  g_autofree gchar *basename = g_path_get_basename(con);
+  name = basename;
 
-  g_free(cmdline);
   return true;
 }