From c392b9bc820824da9f0ec38ddafb8d0f36f6f0a5 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Wed, 28 Jan 2015 16:36:27 +0200 Subject: [PATCH] shared/gatt-helpers: Fix use after free src/shared/gatt-helpers.c:851:9: warning: Use of memory after it is freed return op->id ? true : false; ^~~~~~ --- src/shared/gatt-helpers.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/shared/gatt-helpers.c b/src/shared/gatt-helpers.c index 34e4bedc4..a33f9608f 100644 --- a/src/shared/gatt-helpers.c +++ b/src/shared/gatt-helpers.c @@ -845,10 +845,12 @@ static bool discover_services(struct bt_att *att, bt_uuid_t *uuid, discovery_op_unref); } - if (!op->id) + if (!op->id) { free(op); + return false; + } - return op->id ? true : false; + return true; } bool bt_gatt_discover_all_primary_services(struct bt_att *att, bt_uuid_t *uuid, -- 2.47.3