summaryrefslogtreecommitdiff
path: root/profiles/input
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2013-12-07 15:53:41 +0100
committerJohan Hedberg <johan.hedberg@intel.com>2013-12-10 11:07:35 +0200
commite6b5ba499a0729fbd9666ab712e2e7fe84dbd8fc (patch)
treec2be743869bb18c19c55731b1d3cca582ecb46e8 /profiles/input
parent7560b22e969cfbec8e9dcf71a2775364f3440add (diff)
downloadbluez-e6b5ba499a0729fbd9666ab712e2e7fe84dbd8fc.tar.gz
input: Fix crash when SDP record isn't available
On startup, if the SDP cache has been removed but the pairing information is still present, we'd crash trying to access inside a NULL record struct.
Diffstat (limited to 'profiles/input')
-rw-r--r--profiles/input/device.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/profiles/input/device.c b/profiles/input/device.c
index 521aca8db..62f6dbb27 100644
--- a/profiles/input/device.c
+++ b/profiles/input/device.c
@@ -811,6 +811,9 @@ static struct input_device *input_device_new(struct btd_service *service)
struct input_device *idev;
char name[HCI_MAX_NAME_LENGTH + 1];
+ if (!rec)
+ return NULL;
+
idev = g_new0(struct input_device, 1);
bacpy(&idev->src, btd_adapter_get_address(adapter));
bacpy(&idev->dst, device_get_address(device));