Fix svace issues
[platform/core/connectivity/zigbee-manager.git] / zigbee-daemon / zigbee-interface / src / zigbee_service_dbus_interface_zcl_scene.c
index dc57f00..655e1c7 100644 (file)
@@ -93,6 +93,7 @@ static gboolean on_zcl_scene_add_scene(ZigbeeZcl_scene *zcl_scene_object,
 
        GVariantIter *iter = NULL;
        gint i = 0;
+       unsigned char value = 0;
 
        gboolean ret;
 
@@ -105,7 +106,7 @@ static gboolean on_zcl_scene_add_scene(ZigbeeZcl_scene *zcl_scene_object,
        req.scene_id = scene_id;
        req.transition_time = transition_time;
        g_variant_get(scene_name, "a(y)", &iter);
-       while (g_variant_iter_loop(iter, "(y)", req.scene_name[i])) {
+       while (g_variant_iter_loop(iter, "(y)", &(req.scene_name[i]))) {
                i++;
                if (i >= ZIGBEE_ZCL_GROUP_NAME_MAX_LEN + 1)
                        break;
@@ -115,7 +116,8 @@ static gboolean on_zcl_scene_add_scene(ZigbeeZcl_scene *zcl_scene_object,
        req.ext_field_set_len = ext_length;
        req.ext_field_set = g_malloc0(ext_length);
        g_variant_get(ext_field_set, "a(y)", &iter);
-       while (g_variant_iter_loop(iter, "(y)", req.ext_field_set[i])) {
+       while (g_variant_iter_loop(iter, "(y)", &value)) {
+               req.ext_field_set[i] = value;
                i++;
                if (i >= ext_length)
                        break;
@@ -131,6 +133,7 @@ static gboolean on_zcl_scene_add_scene(ZigbeeZcl_scene *zcl_scene_object,
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.ext_field_set);
                return TRUE;
        }
 
@@ -694,7 +697,7 @@ void zigbee_service_dbus_interface_zcl_scene_notification(ZigBeeServiceInterface
 
        NOT_USED(noti_cb_data);
 
-       switch(noti_id) {
+       switch (noti_id) {
        case ZBLIB_ZCL_SCENE_NOTI_ADD_SCENE: {
                ZigbeeZclSceneAddSceneResp_t *rsp = (ZigbeeZclSceneAddSceneResp_t*)noti_data;