From 5be2aad5297c86f70e71a4370436f0aad19fca55 Mon Sep 17 00:00:00 2001 From: Andrei Emeltchenko Date: Tue, 19 May 2015 10:49:57 +0300 Subject: [PATCH] gatt: Fix memory leak in profile_add Cleanup memory correctly. --- src/gatt-database.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gatt-database.c b/src/gatt-database.c index dd80aa0f1..ca514db3e 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -2299,8 +2299,11 @@ static int profile_add(struct external_profile *profile, const char *uuid) return -ENOMEM; p->remote_uuid = (const void *) g_strdup(uuid); - if (!p->remote_uuid) + if (!p->remote_uuid) { + g_free((void *) p->name); + free((void *) p); return -ENOMEM; + } p->auto_connect = true; -- 2.47.3