Fix Coverity issue : 22384, 41860
[platform/core/connectivity/zigbee-manager.git] / zigbee-daemon / zigbee-interface / src / zigbee_service_dbus_interface_zcl_global_control.c
old mode 100644 (file)
new mode 100755 (executable)
index 1478f0e..91973d5
@@ -1385,6 +1385,8 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService
                                attr_t->cluster_id, attr_t->status, attr_t->type,
                                attr_t->record_length, attr_t->is_string);
                }
+               if (v_values)
+                       g_variant_unref(v_values);
        break;
        }
        case ZBLIB_ZCL_GLOBAL_NOTI_WRITE_ATTR_RSP: {
@@ -1400,16 +1402,16 @@ void zigbee_service_dbus_interface_zcl_global_control_notification(ZigBeeService
                        TRUE, NULL, NULL);
                if (NULL == v_values || NULL == v_attrs) {
                        Z_LOGE("Failed to create variant!");
-                       if (v_values)
-                               g_variant_unref(v_values);
-                       if (v_attrs)
-                               g_variant_unref(v_attrs);
                } else {
                        Z_LOGD("Write attributes resp");
                        zigbee_zcl_global_control_emit_write_attributes_rsp(global_control_object,
                                attr_t->node_id, attr_t->src_ep, v_values, v_attrs,
                                attr_t->cluster_id, attr_t->record_length);
                }
+               if (v_values)
+                       g_variant_unref(v_values);
+               if (v_attrs)
+                       g_variant_unref(v_attrs);
        break;
        }
        case ZBLIB_ZCL_GLOBAL_NOTI_CONFIG_REPORT_RSP: {