From f7138dd76d2b0ec56474c7233ac04dd09166f9b2 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Tue, 7 Jul 2015 22:30:53 +0300 Subject: [PATCH] core: gatt-database: Fix potential memory leak --- src/gatt-database.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gatt-database.c b/src/gatt-database.c index ca514db3e..a1ae7bda5 100644 --- a/src/gatt-database.c +++ b/src/gatt-database.c @@ -2295,8 +2295,10 @@ static int profile_add(struct external_profile *profile, const char *uuid) /* Assign directly to avoid having extra fields */ p->name = (const void *) g_strdup_printf("%s%s/%s", profile->owner, profile->path, uuid); - if (!p->name) + if (!p->name) { + free(p); return -ENOMEM; + } p->remote_uuid = (const void *) g_strdup(uuid); if (!p->remote_uuid) { -- 2.47.3