From 0ab2888b952c5d766864b4c66aefc2ac252b9393 Mon Sep 17 00:00:00 2001 From: Haejeong Kim Date: Thu, 8 Jun 2017 14:25:06 +0900 Subject: [PATCH] PVS-studio error fix (https://www.slideshare.net/Andrey_Karpov/pvsstudio-is-ready-to-improve-the-code-of-tizen-operating-system) Change-Id: Idbbdb425e183dfafc8728d96018f35972c821a3d --- packaging/capi-content-media-content.spec | 2 +- test/media-content_test.c | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packaging/capi-content-media-content.spec b/packaging/capi-content-media-content.spec index b36928b..0c6d02b 100755 --- a/packaging/capi-content-media-content.spec +++ b/packaging/capi-content-media-content.spec @@ -1,6 +1,6 @@ Name: capi-content-media-content Summary: A Media content library in Tizen Native API -Version: 0.3.12 +Version: 0.3.13 Release: 0 Group: Multimedia/API License: Apache-2.0 diff --git a/test/media-content_test.c b/test/media-content_test.c index c8493cb..f219a27 100755 --- a/test/media-content_test.c +++ b/test/media-content_test.c @@ -3070,7 +3070,7 @@ void insert_batch_cb(media_content_error_e error, void * user_data) int test_batch_operations() { int ret = -1; - int i; + int i = 0; char *file_list[10]; for (i = 0; i < 10; i++) { @@ -3085,8 +3085,13 @@ int test_batch_operations() media_content_error("media_info_insert_batch_to_db failed : %d\n", ret); filter_h filter; - char *condition = "MEDIA_PATH LIKE \'"; - strncat(condition, tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%jpg\'"), 17); + char condition[2048] = {0, }; + const char *temp = NULL; + memset(condition, 0x00, sizeof(condition)); + + temp = tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%jpg\'"); + snprintf(condition, sizeof(condition), "MEDIA_PATH LIKE \'%s", temp); + ret = media_filter_create(&filter); if (ret != MEDIA_CONTENT_ERROR_NONE) { media_content_error("Fail to create filter"); @@ -3336,6 +3341,8 @@ gboolean _send_noti_operations(gpointer data) filter_h filter; char condition[2048] = {0,}; const char *temp = NULL; + memset(condition, 0x00, sizeof(condition)); + temp = tzplatform_mkpath(TZ_USER_CONTENT, "test/image%%\'"); snprintf(condition, sizeof(condition), "MEDIA_PATH LIKE \'%s", temp); -- 2.7.4