Hi Marcin, > 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 d9f63be..36316af 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); I think the real question is why a function with void *data is called with a NULL pointer in the first place. That is the thing you should fix and not hack around this by doing a NULL check. So this is clearly a function that you gave to callback somehow, fix that part. I do not remember any of the code in src/shared/ that has the destroy callbacks requiring any of this. We are expecting that data is valid. Regards Marcel -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html