From: mk5004.lee Date: Wed, 20 May 2020 11:36:17 +0000 (+0900) Subject: Fix private_sharing error issue X-Git-Tag: submit/tizen/20200520.120513~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b476bf69fd529870a3cf9226186041d5ec1a9dca;p=platform%2Fcore%2Fapi%2Fnotification.git Fix private_sharing error issue Change-Id: I97569ce573452f5ed6e3200f8ca3ad4bd3272a6d Signed-off-by: mk5004.lee --- diff --git a/notification/src/notification_shared_file.c b/notification/src/notification_shared_file.c index 8c14f067..5e2677da 100644 --- a/notification/src/notification_shared_file.c +++ b/notification/src/notification_shared_file.c @@ -685,14 +685,16 @@ EXPORT_API bool notification_validate_private_sharing( notification_h updated_noti) { char *updated_path = NULL; - char *private_path; + char *private_path = NULL; char buf_key[32] = { 0, }; int i = NOTIFICATION_IMAGE_TYPE_ICON; if (updated_noti->b_image_path && updated_noti->b_priv_image_path) { for (; i <= NOTIFICATION_IMAGE_TYPE_MAX; i++) { - snprintf(buf_key, sizeof(buf_key), "%d", i); + updated_path = NULL; + private_path = NULL; + snprintf(buf_key, sizeof(buf_key), "%d", i); bundle_get_str(updated_noti->b_image_path, buf_key, &updated_path); if (updated_path == NULL) @@ -705,8 +707,6 @@ EXPORT_API bool notification_validate_private_sharing( if (strcmp(updated_path, private_path) == 0) return false; - - updated_path = NULL; } } @@ -736,6 +736,10 @@ EXPORT_API void notification_calibrate_private_sharing( if (updated_noti->b_image_path && updated_noti->b_priv_image_path) { for (; i <= NOTIFICATION_IMAGE_TYPE_MAX; i++) { + source_path = NULL; + updated_path = NULL; + private_path = NULL; + snprintf(buf_key, sizeof(buf_key), "%d", i); bundle_get_str(updated_noti->b_image_path, buf_key, &updated_path); @@ -756,9 +760,6 @@ EXPORT_API void notification_calibrate_private_sharing( buf_key, source_path); } } - source_path = NULL; - updated_path = NULL; - private_path = NULL; } } @@ -766,9 +767,11 @@ EXPORT_API void notification_calibrate_private_sharing( if (strcmp(updated_noti->sound_path, updated_noti->priv_sound_path) == 0) { free(updated_noti->sound_path); - updated_noti->sound_path = strdup(source_noti->sound_path); - if (updated_noti->sound_path == NULL) - ERR("out of memory"); + if (source_noti->sound_path) { + updated_noti->sound_path = strdup(source_noti->sound_path); + if (updated_noti->sound_path == NULL) + ERR("out of memory"); + } } } @@ -776,10 +779,12 @@ EXPORT_API void notification_calibrate_private_sharing( if (strcmp(updated_noti->vibration_path, updated_noti->priv_vibration_path) == 0) { free(updated_noti->vibration_path); - updated_noti->vibration_path = - strdup(source_noti->priv_vibration_path); - if (updated_noti->vibration_path == NULL) - ERR("out of memory"); + if (source_noti->priv_vibration_path) { + updated_noti->vibration_path = + strdup(source_noti->priv_vibration_path); + if (updated_noti->vibration_path == NULL) + ERR("out of memory"); + } } } }