Static tools demands the code should handle all error cases.
Fix memory leak and static tools demands.
Change-Id: Idebd2ebf0222067da2acc796b19441a5cb0584f1
Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
BT_DEVICE_INTERFACE,
NULL, &err);
- if (err) {
+ if (device_gproxy == NULL && err) {
BT_ERR("Unable to create proxy: %s", err->message);
g_clear_error(&err);
return NULL;
BT_MANAGER_INTERFACE,
NULL, &error);
- if (error) {
+ if (manager_proxy == NULL && error) {
BT_ERR("Unable to create proxy: %s", error->message);
g_clear_error(&error);
return NULL;
parameters = g_variant_new("(a{sv}as)", inner_builder, invalidated_builder);
g_variant_builder_unref(invalidated_builder);
g_variant_builder_unref(inner_builder);
- } else if (BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED) {
+ } else if (event == BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED) {
GVariantBuilder *inner_builder;
GVariantBuilder *invalidated_builder;
parameters = g_variant_new("(a{sv}as)", inner_builder, invalidated_builder);
g_variant_builder_unref(invalidated_builder);
g_variant_builder_unref(inner_builder);
+ } else {
+ g_varaiant_unref(var);
}
msg = g_dbus_message_new_signal(BT_HPS_OBJECT_PATH, BT_HPS_INTERFACE_NAME, PROPERTIES_CHANGED);
g_byte_array_append(gp_byte_array,
(const guint8 *)g_variant_get_data(val), len);
if (gp_byte_array->len != 0) {
- GVariant *byte_array = NULL;
- byte_array = g_variant_new_from_data(
- G_VARIANT_TYPE_BYTESTRING,
- gp_byte_array->data,
- gp_byte_array->len,
- TRUE, NULL, NULL);
-
if (strcmp(path, http_uri_obj_path)) {
//Retrive URI
_bt_hps_uri_write_cb(NULL, len);
priv->busname = NULL;
} else {
priv->busname = g_strdup(g_dbus_proxy_get_name(proxy));
- g_object_unref(proxy);
BT_DBG("Busname: %s", priv->busname);
+ g_object_unref(proxy);
}
}
BT_OBEX_CLIENT_PATH,
BT_OBEX_CLIENT_INTERFACE,
NULL, &err);
- if (err) {
+ if (session_proxy == NULL && err) {
BT_ERR("Unable to create session_proxy: %s", err->message);
g_clear_error(&err);
return BLUETOOTH_ERROR_INTERNAL;
}
- retv_if(session_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
GVariantBuilder* builder = g_variant_builder_new(G_VARIANT_TYPE_ARRAY);
g_variant_builder_add(builder, "{sv}", "Target",
BT_OBEX_CLIENT_PATH,
BT_OBEX_CLIENT_INTERFACE,
NULL, &err);
- if (err) {
+ if (session_proxy == NULL && err) {
BT_ERR("Unable to create session_proxy: %s", err->message);
g_clear_error(&err);
return BLUETOOTH_ERROR_INTERNAL;
}
- retv_if(session_proxy == NULL, BLUETOOTH_ERROR_INTERNAL);
GVariant *param = g_variant_new("(o)", session_id);
BT_OBEX_TRANSFER_INTERFACE,
NULL, &err);
- if (err) {
+ if (proxy == NULL && err) {
BT_ERR("Error : %s", err->message);
g_clear_error(&err);
return NULL;
transfer_path,
BT_PROPERTIES_INTERFACE,
NULL, &err);
- if (err) {
+ if (proxy == NULL && err) {
BT_ERR("Error : %s", err->message);
g_clear_error(&err);
return NULL;