From 0721e76a596c6e1affc1d1cab8b22e4cd7b18794 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 19 Mar 2014 16:26:16 +0200 Subject: [PATCH] core: Fix agent ref leak when freeing auth request --- src/device.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/device.c b/src/device.c index a4ea140d8..67a9a574a 100644 --- a/src/device.c +++ b/src/device.c @@ -3976,9 +3976,17 @@ void device_set_paired(struct btd_device *dev, uint8_t bdaddr_type) static void device_auth_req_free(struct btd_device *device) { - if (device->authr) - g_free(device->authr->pincode); - g_free(device->authr); + struct authentication_req *authr = device->authr; + + if (!authr) + return; + + if (authr->agent) + agent_unref(authr->agent); + + g_free(authr->pincode); + g_free(authr); + device->authr = NULL; } -- 2.47.3