free current_path when stop scan 28/234828/1 accepted/tizen/unified/20200601.051806 accepted/tizen/unified/20200604.164551 submit/tizen/20200601.002459 submit/tizen/20200603.011259
authorchengyj1985 <yujie.cheng@samsung.com>
Fri, 29 May 2020 05:44:17 +0000 (13:44 +0800)
committerchengyj1985 <yujie.cheng@samsung.com>
Fri, 29 May 2020 05:44:17 +0000 (13:44 +0800)
Change-Id: I8ebda21373640e75fae379256f460d29bf54c2b8

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

index b42f0b6..2a25932 100644 (file)
@@ -316,7 +316,7 @@ static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, co
                        ret = ms_check_scan_ignore(current_path, uid);
                        if (ret != MS_MEDIA_ERR_NONE) {
                                MS_DBG_SERR("%s is ignore", current_path);
-                               g_free(current_path);
+                               MS_SAFE_FREE(current_path);
                                if (ret == MS_MEDIA_ERR_USB_UNMOUNTED)
                                        goto STOP_SCAN;
                                else
@@ -541,6 +541,7 @@ STOP_SCAN:
        MS_DBG_ERR("stop folder scan...");
        ms_insert_folder_end(uid);
        ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_STOP, uid);
+       MS_SAFE_FREE(current_path);
 
 END_SCAN:
        if (fd != -1) {
@@ -860,6 +861,7 @@ STOP_SCAN:
        ms_insert_folder_end(uid);
        if (current_path != NULL)
                ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_STOP, uid);
+       MS_SAFE_FREE(current_path);
 
 EXIT: