Merge "Fix NULL Returns in bt-api/bt-hid-device.c" into tizen
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / bt-service-util.c
index 5afbc4e..b1aab41 100644 (file)
@@ -1,13 +1,17 @@
 /*
- * bluetooth-frwk
+ * Bluetooth-frwk
  *
- * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
+ *              Girishashok Joshi <girish.joshi@samsung.com>
+ *              Chanyeol Park <chanyeol.park@samsung.com>
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  *
- *              http://www.apache.org/licenses/LICENSE-2.0
+ *             http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  */
 
 #include <string.h>
-#include <dbus/dbus-glib.h>
-#include <dbus/dbus.h>
 #include <glib.h>
 #include <dlog.h>
+#include <gio/gio.h>
 
 #include "bluetooth-api.h"
 #include "bt-service-common.h"
@@ -84,11 +87,13 @@ void _bt_init_request_list(void)
 
 /* insert request next to head */
 int _bt_insert_request_list(int req_id, int service_function,
-                       char *name, DBusGMethodInvocation *context)
+                       char *name, GDBusMethodInvocation *context)
 {
        request_info_t *info;
 
        info = g_malloc0(sizeof(request_info_t));
+       /* Fix : NULL_RETURNS */
+       retv_if(info == NULL, BLUETOOTH_ERROR_MEMORY_ALLOCATION);
 
        info->req_id = req_id;
        info->service_function = service_function;
@@ -129,6 +134,7 @@ int _bt_delete_request_list(int req_id)
 
                if (info->req_id == req_id) {
                        req_list = g_slist_remove(req_list, info);
+                       _bt_delete_request_id(info->req_id);
                        g_free(info);
                        return BLUETOOTH_ERROR_NONE;
                }