From a148b6bbf93056a186b539f4351d2cf125b57002 Mon Sep 17 00:00:00 2001 From: Marcin Kraglak Date: Fri, 16 May 2014 12:07:07 +0200 Subject: [PATCH] shared/gatt: Fix freeing uninitialized attributes Don't free uninitialized attributes. It could cause NULL pointer dereference. --- src/shared/gatt-db.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/shared/gatt-db.c b/src/shared/gatt-db.c index d9f63be20..36316affd 100644 --- a/src/shared/gatt-db.c +++ b/src/shared/gatt-db.c @@ -99,6 +99,10 @@ static void attribute_destroy(void *data) { struct gatt_db_attribute *attribute = data; + /* Attribute was not initialized by user */ + if (!attribute) + return; + free(attribute->value); free(attribute); } -- 2.47.3