Return error if path is invalid 97/199197/1
authorhj kim <backto.kim@samsung.com>
Thu, 7 Feb 2019 06:25:21 +0000 (15:25 +0900)
committerhj kim <backto.kim@samsung.com>
Thu, 7 Feb 2019 06:25:21 +0000 (15:25 +0900)
Change-Id: Ib7a540948ba9d7d189af1b14eb0558ef1fc9e7ae

lib/media-util-user.c

index 0a9f053..934d86b 100755 (executable)
@@ -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]);