From 9d8fad534b43b7be1c9c24608abca8b4cc52ee14 Mon Sep 17 00:00:00 2001 From: hj kim Date: Thu, 7 Feb 2019 15:25:21 +0900 Subject: [PATCH] Return error if path is invalid Change-Id: Ib7a540948ba9d7d189af1b14eb0558ef1fc9e7ae --- lib/media-util-user.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/media-util-user.c b/lib/media-util-user.c index 0a9f053..934d86b 100755 --- a/lib/media-util-user.c +++ b/lib/media-util-user.c @@ -63,6 +63,7 @@ static int __ms_user_get_path(ms_user_path_type_e type, const char *storage_id, idx = uid - 5000; MSAPI_RETVM_IF(idx < 0 || idx > 127, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid uid"); + MSAPI_RETVM_IF(path == NULL, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path"); g_mutex_lock(&tzplatform_mutex); @@ -101,7 +102,12 @@ static int __ms_user_get_path(ms_user_path_type_e type, const char *storage_id, break; } - *path = g_strdup(result); + if (MS_STRING_VALID(result)) { + *path = g_strdup(result); + } else { + MSAPI_DBG_ERR("Fail to get the path"); + ret = MS_MEDIA_ERR_INTERNAL; + } ERROR: tzplatform_context_destroy(context[idx]); -- 2.7.4