Fix memory leak in testsuite 81/228681/1 accepted/tizen/unified/20200325.144443 submit/tizen/20200324.064947
authorjiyong.min <jiyong.min@samsung.com>
Tue, 24 Mar 2020 23:03:26 +0000 (08:03 +0900)
committerjiyong.min <jiyong.min@samsung.com>
Tue, 24 Mar 2020 23:12:19 +0000 (08:12 +0900)
Change-Id: I773ec68db6e87dfebb9c528ec09018cc2fecf650

test/media-content_test.c

index 508eefa..8fc4103 100755 (executable)
@@ -2645,16 +2645,17 @@ int test_batch_operations()
        char *file_list[10];
 
        for (i = 0; i < 10; i++) {
-               char filepath[255] = {0,};
-               snprintf(filepath, sizeof(filepath), "%s%d.jpg", tzplatform_mkpath(TZ_USER_CONTENT, "test/image"), i+1);
-               media_content_debug("File : %s\n", filepath);
-               file_list[i] = strdup(filepath);
+               file_list[i] = g_strdup_printf("%s%d.jpg", tzplatform_mkpath(TZ_USER_CONTENT, "test/image"), i+1);
+               media_content_debug("File : %s\n", file_list[i]);
        }
 
        ret = media_info_insert_batch_to_db((const char **)file_list, 10, insert_batch_cb, NULL);
        if (ret != MEDIA_CONTENT_ERROR_NONE)
                media_content_error("media_info_insert_batch_to_db failed : %d\n", ret);
 
+       for (i = 0; i < 10; i++)
+               g_free(file_list[i]);
+
        return ret;
 }