Upgrade bluez5_37 :Merge the code from private
[platform/upstream/bluez.git] / android / hal-bluetooth.c
old mode 100644 (file)
new mode 100755 (executable)
index e24f7d2..66f4a37
@@ -19,6 +19,7 @@
 #include <stdlib.h>
 #include <stdbool.h>
 #include <string.h>
+#include <errno.h>
 
 #include <cutils/properties.h>
 
@@ -1103,6 +1104,11 @@ static int open_bluetooth(const struct hw_module_t *module, char const *name,
 
        DBG("");
 
+       if (!dev) {
+               error("Failed to allocate memory for device");
+               return -ENOMEM;
+       }
+
        memset(dev, 0, sizeof(bluetooth_device_t));
        dev->common.tag = HARDWARE_DEVICE_TAG;
        dev->common.version = 0;