pass: parser: Check NULL before reference 67/281567/1
authorDongwoo Lee <dwoo08.lee@samsung.com>
Tue, 20 Sep 2022 03:21:01 +0000 (12:21 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Tue, 20 Sep 2022 03:21:01 +0000 (12:21 +0900)
Change-Id: Ifae8c9ae87a9f79bae5b79450b504d3025ecee24
Signed-off-by: Dongwoo Lee <dwoo08.lee@samsung.com>
src/pass/pass-parser.c

index 8bff029..4e16a43 100644 (file)
@@ -639,14 +639,15 @@ static int parse_each_resource(struct pass_resource *res, json_object *obj)
  */
 static int parse_resource_data(struct pass *pass, int id, json_object *obj)
 {
-       struct pass_resource_config_data *config_data
-                               = &(pass->res[id].config_data);
+       struct pass_resource_config_data *config_data;
        char device_type[BUFF_MAX] = {};
        int ret = 0;
 
        if(!pass || id < 0 || !obj)
                return -EINVAL;
 
+       config_data = &(pass->res[id].config_data);
+
        /* Get property values */
        struct config_property resource_properties[] = {
                { "device_type",        DATA_TYPE_STRING, true, (void *)device_type },