Fix static analysis issue 60/238860/3
authorJusung Son <jusung07.son@samsung.com>
Mon, 20 Jul 2020 01:56:16 +0000 (10:56 +0900)
committerJusung Son <jusung07.son@samsung.com>
Mon, 20 Jul 2020 06:04:30 +0000 (15:04 +0900)
 - NULL_AFTER_DEREF
 - DEREF_OF_NULL.RET.STAT

Change-Id: I50aafde305407ff1c6d37b74bda2eaa4c35e4bda
Signed-off-by: Jusung Son <jusung07.son@samsung.com>
src/data_control_internal.c
src/data_control_provider.c

index d426ba6..40a706c 100644 (file)
@@ -1824,8 +1824,7 @@ int _register_response_cb(data_control_h provider, void *response_cb,
        else if (strcasecmp(access, "readwrite") == 0)
                access_info = ACCESS_INFO_READ_WRITE;
 
-       if (access)
-               free(access);
+       free(access);
 
        _LOGI("data control provider appid = %s, handle_id = %d, is_bind = %d\n",
                        app_id, provider->handle_id, is_bind);
index 8213f0e..0937ea5 100644 (file)
@@ -1612,6 +1612,10 @@ int __provider_process(bundle *b, int fd, const char *consumer_appid)
        }
 
        arg_list = bundle_get_str_array(b, OSP_K_ARG, &len);
+       if (arg_list == NULL || len <= 0) {
+               _LOGE("Invalid OSP_K_ARG array");
+               return DATA_CONTROL_ERROR_INVALID_PARAMETER;
+       }
 
        provider = malloc(sizeof(struct data_control_s));
        if (provider == NULL) {