[PATCH 15/17] HDP: Fix possible memory leak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Andrei Emeltchenko <andrei.emeltchenko@xxxxxxxxx>

---
 profiles/health/hdp_util.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/profiles/health/hdp_util.c b/profiles/health/hdp_util.c
index 7185805..876a105 100644
--- a/profiles/health/hdp_util.c
+++ b/profiles/health/hdp_util.c
@@ -597,6 +597,13 @@ fail:
 	return NULL;
 }
 
+static void free_hdp_list(void *list)
+{
+	sdp_list_t *hdp_list = list;
+
+	sdp_list_free(hdp_list, (sdp_free_func_t)sdp_data_free);
+}
+
 static gboolean register_features(struct hdp_application *app,
 						sdp_list_t **sup_features)
 {
@@ -619,16 +626,11 @@ static gboolean register_features(struct hdp_application *app,
 fail:
 	if (hdp_feature != NULL)
 		sdp_list_free(hdp_feature, (sdp_free_func_t)sdp_data_free);
+	if (sup_features != NULL)
+		sdp_list_free(*sup_features, free_hdp_list);
 	return FALSE;
 }
 
-static void free_hdp_list(void *list)
-{
-	sdp_list_t *hdp_list = list;
-
-	sdp_list_free(hdp_list, (sdp_free_func_t)sdp_data_free);
-}
-
 static gboolean register_service_sup_features(GSList *app_list,
 						sdp_record_t *sdp_record)
 {
-- 
1.8.3.2

--
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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux