Fix svace issues submit/tizen/20170512.045637
authorJiwan Kim <ji-wan.kim@samsung.com>
Thu, 11 May 2017 05:29:21 +0000 (14:29 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Thu, 11 May 2017 09:10:26 +0000 (18:10 +0900)
Change-Id: I4f396cba56dfcf97505180131a7537c16320752b
Signed-off-by: Jiwan Kim <ji-wan.kim@samsung.com>
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_global_control.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zcl_scene.c
zigbee-daemon/zigbee-interface/src/zigbee_service_dbus_interface_zdo_dev_control.c
zigbee-daemon/zigbee-lib/src/zblib_service.c

index 19eb958..9c5a0e8 100644 (file)
@@ -216,6 +216,7 @@ static gboolean on_zclglobal_control_write_attributes_req(ZigbeeZcl_global_contr
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.write_records);
                return TRUE;
        }
 
@@ -245,6 +246,7 @@ static gboolean on_zclglobal_control_write_attributes_req(ZigbeeZcl_global_contr
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.write_records);
                return TRUE;
        }
 
@@ -254,6 +256,10 @@ static gboolean on_zclglobal_control_write_attributes_req(ZigbeeZcl_global_contr
                ZBLIB_ZCL_GLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_REQ,
                &req, sizeof(req),
                on_zclglobal_control_write_attributes_req_resp, resp_cb_data);
+
+       /* Free resource */
+       g_free(req.write_records);
+
        if (FALSE == ret) {
                Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
 
@@ -330,6 +336,7 @@ static gboolean on_zclglobal_control_write_attributes_undivided_req(ZigbeeZcl_gl
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.write_records);
                return TRUE;
        }
 
@@ -357,6 +364,7 @@ static gboolean on_zclglobal_control_write_attributes_undivided_req(ZigbeeZcl_gl
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.write_records);
                return TRUE;
        }
 
@@ -366,6 +374,10 @@ static gboolean on_zclglobal_control_write_attributes_undivided_req(ZigbeeZcl_gl
                ZBLIB_ZCL_GLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_UNDIVIDED_REQ,
                &req, sizeof(req),
                on_zclglobal_control_write_attributes_undivided_req_resp, resp_cb_data);
+
+       /* Free resource */
+       g_free(req.write_records);
+
        if (FALSE == ret) {
                Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
 
@@ -442,6 +454,7 @@ static gboolean on_zclglobal_control_write_attributes_no_resp(ZigbeeZcl_global_c
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.write_records);
                return TRUE;
        }
 
@@ -469,6 +482,7 @@ static gboolean on_zclglobal_control_write_attributes_no_resp(ZigbeeZcl_global_c
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.write_records);
                return TRUE;
        }
 
@@ -478,6 +492,10 @@ static gboolean on_zclglobal_control_write_attributes_no_resp(ZigbeeZcl_global_c
                ZBLIB_ZCL_GLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_NO_RESP,
                &req, sizeof(req),
                on_zclglobal_control_write_attributes_no_resp_resp, resp_cb_data);
+
+       /* Free resource */
+       g_free(req.write_records);
+
        if (FALSE == ret) {
                Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
 
@@ -554,6 +572,7 @@ static gboolean on_zclglobal_control_write_attributes_structured(ZigbeeZcl_globa
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.write_records);
                return TRUE;
        }
 
@@ -581,6 +600,7 @@ static gboolean on_zclglobal_control_write_attributes_structured(ZigbeeZcl_globa
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.write_records);
                return TRUE;
        }
 
@@ -590,6 +610,10 @@ static gboolean on_zclglobal_control_write_attributes_structured(ZigbeeZcl_globa
                ZBLIB_ZCL_GLOBAL_CONTROL_OPS_WRITE_ATTRIBUTES_STRUCTURED,
                &req, sizeof(req),
                on_zclglobal_control_write_attributes_structured_resp, resp_cb_data);
+
+       /* Free resource */
+       g_free(req.write_records);
+
        if (FALSE == ret) {
                Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
 
@@ -666,6 +690,7 @@ static gboolean on_zclglobal_control_read_attributes_structured(ZigbeeZcl_global
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.read_records);
                return TRUE;
        }
 
@@ -693,6 +718,7 @@ static gboolean on_zclglobal_control_read_attributes_structured(ZigbeeZcl_global
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.read_records);
                return TRUE;
        }
 
@@ -702,6 +728,10 @@ static gboolean on_zclglobal_control_read_attributes_structured(ZigbeeZcl_global
                ZBLIB_ZCL_GLOBAL_CONTROL_OPS_READ_ATTRIBUTES_STRUCTURED,
                &req, sizeof(req),
                on_zclglobal_control_read_attributes_structured_resp, resp_cb_data);
+
+       /* Free resource */
+       g_free(req.read_records);
+
        if (FALSE == ret) {
                Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
 
@@ -778,6 +808,7 @@ static gboolean on_zclglobal_control_configure_reporting_req(ZigbeeZcl_global_co
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.read_records);
                return TRUE;
        }
 
@@ -805,6 +836,7 @@ static gboolean on_zclglobal_control_configure_reporting_req(ZigbeeZcl_global_co
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.read_records);
                return TRUE;
        }
 
@@ -814,6 +846,10 @@ static gboolean on_zclglobal_control_configure_reporting_req(ZigbeeZcl_global_co
                ZBLIB_ZCL_GLOBAL_CONTROL_OPS_CONFIGURE_REPORTING_REQ,
                &req, sizeof(req),
                on_zclglobal_control_configure_reporting_req_resp, resp_cb_data);
+
+       /* Free resource */
+       g_free(req.read_records);
+
        if (FALSE == ret) {
                Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
 
@@ -890,6 +926,7 @@ static gboolean on_zclglobal_control_read_configure_reporting(ZigbeeZcl_global_c
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.read_records);
                return TRUE;
        }
 
@@ -917,6 +954,7 @@ static gboolean on_zclglobal_control_read_configure_reporting(ZigbeeZcl_global_c
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.read_records);
                return TRUE;
        }
 
@@ -926,6 +964,10 @@ static gboolean on_zclglobal_control_read_configure_reporting(ZigbeeZcl_global_c
                ZBLIB_ZCL_GLOBAL_CONTROL_OPS_READ_CONFIGURE_REPORTING,
                &req, sizeof(req),
                on_zclglobal_control_read_configure_reporting_resp, resp_cb_data);
+
+       /* Free resource */
+       g_free(req.read_records);
+
        if (FALSE == ret) {
                Z_LOGE("zigbee_service_dbus_interface_dispatch_request failed!");
 
index a7c9832..655e1c7 100644 (file)
@@ -133,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;
        }
 
index 15f3fa2..6012740 100644 (file)
@@ -230,6 +230,8 @@ static gboolean on_zdodev_control_matched_descriptor_req(ZigbeeZdo_dev_control *
                /* Send failure response */
                ZIGBEE_DBUS_FAIL_RESPONSE(invocation, ZIGBEE_DBUS_DEFAULT_REQ_FAILED_MSG);
 
+               g_free(req.in_cl);
+               g_free(req.out_cl);
                return TRUE;
        }
 
index df81d69..ff46159 100644 (file)
@@ -79,10 +79,10 @@ static void __on_zblib_init_async_finished(gboolean result, void *user_data)
 
        plugin = info->plugin;
        service = zblib_plugin_ref_service(plugin);
-       plugin_name = zblib_plugin_get_plugin_name(plugin);
-
        zblib_check_null_ret("service", service);
 
+       plugin_name = zblib_plugin_get_plugin_name(plugin);
+
        info->is_finished = TRUE;
        if (result) {
                Z_LOGD("Plugin [%s] succeeded async init", plugin_name);
@@ -215,11 +215,12 @@ static gboolean __zblib_service_init_async_plugin(ZigBeePlugin *plugin,
                zblib_plugin_init_finished_cb callback, void *user_data)
 {
        const ZblibPluginDescriptor_t *descriptor = zblib_plugin_get_descriptor(plugin);
-       char *plugin_name = zblib_plugin_get_plugin_name(plugin);
+       char *plugin_name = NULL;
 
        zblib_check_null_ret_error("descriptor", descriptor, FALSE);
        zblib_check_null_ret_error("descriptor->init_async", descriptor->init_async, FALSE);
 
+       plugin_name = zblib_plugin_get_plugin_name(plugin);
        if (G_UNLIKELY(NULL != plugin_name))
                plugin_name = g_strdup("NONAME");