fix coredump issue when free ptr 91/233391/4 accepted/tizen/unified/20200529.124056 submit/tizen/20200515.014457 submit/tizen/20200529.021237
authorchengyj1985 <yujie.cheng@samsung.com>
Thu, 14 May 2020 08:54:28 +0000 (16:54 +0800)
committerchengyj1985 <yujie.cheng@samsung.com>
Thu, 14 May 2020 12:21:29 +0000 (20:21 +0800)
Change-Id: Iacbdfea010bdabc8eeee5c4ab5f784add92c272c

src/scanner-v2/media-scanner-extract-v2.c
src/scanner-v2/media-scanner-scan-v2.c

index 8dada2c..0b894cd 100644 (file)
@@ -304,8 +304,11 @@ NEXT:
                }
 
                g_free(update_path);
+               update_path = NULL;
                g_free(extract_data);
+               extract_data = NULL;
                g_free(storage_id);
+               storage_id = NULL;
 
                __msc_del_cur_extract_item();
                __msc_del_cancel_extract_item();
@@ -475,6 +478,7 @@ STOP_DISC:
                }
 NEXT:
                g_free(update_path);
+               update_path = NULL;
 
                if (power_off2) {
                        MS_DBG_ERR("power off");
@@ -493,6 +497,7 @@ NEXT:
                }
 
                g_free(extract_data);
+               extract_data = NULL;
 
                MS_DBG_WARN("STORAGE EXTRACT END[%d]", ret);
                usleep(SCAN_SLEEP_TIME);
@@ -610,6 +615,7 @@ static void __msc_del_extract_item(s_extract_item** item)
        if (*item != NULL) {
                g_free((*item)->path);
                g_free(*item);
+               *item = NULL;
        }
 }
 
index 3dd8cd5..b42f0b6 100644 (file)
@@ -1279,8 +1279,11 @@ NEXT:
                msc_send_result(ret, scan_data);
 
                g_free(scan_data);
+               scan_data = NULL;
                g_free(storage_id);
+               storage_id = NULL;
                g_free(folder_uuid);
+               folder_uuid = NULL;
 
                g_directory_scan_processing2 = DIR_SCAN_NON_SCAN;
                __msc_del_cur_scan_item();
@@ -1438,6 +1441,7 @@ NEXT:
                __msc_del_blocked_path();
 
                g_free(update_path);
+               update_path = NULL;
 
                if (power_off2) {
                        MS_DBG_ERR("power off");
@@ -1454,6 +1458,7 @@ NEXT:
                msc_send_result(ret, scan_data);
 
                g_free(scan_data);
+               scan_data = NULL;
 
                MS_DBG_WARN("STORAGE SCAN END[%d]", ret);
 
@@ -1699,7 +1704,9 @@ FREE_RESOURCE:
                __msc_clear_file_list(path_array);
 
                g_free(file_path);
+               file_path = NULL;
                g_free(register_data);
+               register_data = NULL;
                usleep(SCAN_SLEEP_TIME);
        }                       /*thread while*/
 
@@ -1745,6 +1752,7 @@ static void __msc_del_scan_item(s_scan_item** item)
        if (*item != NULL) {
                g_free((*item)->path);
                g_free(*item);
+               *item = NULL;
        }
 }