Diff between b42d23e56061cf657e9c6aad98d6afd183ecc4bf and 0721e76a596c6e1affc1d1cab8b22e4cd7b18794

Changed Files

File Additions Deletions Status
src/device.c +11 -3 modified

Full Patch

diff --git a/src/device.c b/src/device.c
index a4ea140..67a9a57 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;
 }