Fix memory leak of mprobe 15/206415/3 accepted/tizen/unified/20190602.221852 submit/tizen/20190520.225431 submit/tizen/20190529.235003
authorYoungHun Kim <yh8004.kim@samsung.com>
Fri, 17 May 2019 09:35:04 +0000 (18:35 +0900)
committerYoungHun Kim <yh8004.kim@samsung.com>
Mon, 20 May 2019 06:15:54 +0000 (15:15 +0900)
 - When mcheck () fails in MRP_INIT time and then mprobe () returns MCHECK_DISABLED, which needs
   to free memory otherwise occur abnormal memory corruption.
   For more detailed, MRP_INIT (memory_check_init) is executed in the parent process of forking and
   __passthru_free is executed in the child process. So variable (mcheck_result) is unnecessary because
   we can consider mprobe returns always only MCHECK_DISABLED and mcheck is not performed at child process.

Change-Id: I123d3af30cb1b84b34b09349952a225ee0ec91ad

packaging/murphy.spec
src/common/mm.c

index 0c080eed365da01492c6d8cb4f357650bd7b72d8..52a5ac57a1b3d43c2da336745935131cb98c73dc 100644 (file)
@@ -29,7 +29,7 @@
 Summary: Resource policy framework
 Name: murphy
 Version: 0.0.75
-Release: 14
+Release: 15
 License: BSD-3-Clause
 Group: System/Service
 URL: http://01.org/murphy/
index d6e595dd95a00a9981d142a1f4475b5afe7c515c..21e0e2da693721d6e4213c36359fa12ec00159c5 100644 (file)
@@ -524,7 +524,7 @@ static int __passthru_memalign(void **ptr, size_t align, size_t size,
 }
 
 #ifndef TIZEN_DISABLE_MEMORY_CHECK
-MRP_INIT static void menory_check_init()
+MRP_INIT static void memory_check_init()
 {
     mcheck(NULL);
 }
@@ -541,11 +541,11 @@ static void __passthru_free(void *ptr, const char *file, int line,
 #ifdef TIZEN_DISABLE_MEMORY_CHECK
     free(ptr);
 #else
-    if (mprobe(ptr) == MCHECK_OK)
+    enum mcheck_status s = mprobe(ptr);
+    if (s == MCHECK_OK || s == MCHECK_DISABLED)
         free(ptr);
-    else {
+    else
         mrp_log_warning("Invalid pointer passed to fuction free");
-    }
 #endif
 }