[PATCH BlueZ 1/2] obexd/client: Fix leaking memory on MNS

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

In case an event is received twice, due to remote side misbehaving or
not, it would leak the previous data.
---
 obexd/client/mns.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/obexd/client/mns.c b/obexd/client/mns.c
index d638886..124dbcf 100644
--- a/obexd/client/mns.c
+++ b/obexd/client/mns.c
@@ -194,6 +194,8 @@ static void parse_event_report_folder(struct map_event *event,
 	if (!value)
 		return;
 
+	g_free(event->folder);
+
 	if (g_str_has_prefix(value, "/"))
 		event->folder = g_strdup(value);
 	else
@@ -206,6 +208,8 @@ static void parse_event_report_old_folder(struct map_event *event,
 	if (!value)
 		return;
 
+	g_free(event->old_folder);
+
 	if (g_str_has_prefix(value, "/"))
 		event->old_folder = g_strdup(value);
 	else
@@ -215,6 +219,10 @@ static void parse_event_report_old_folder(struct map_event *event,
 static void parse_event_report_msg_type(struct map_event *event,
 							const char *value)
 {
+	if (!value)
+		return;
+
+	g_free(event->msg_type);
 	event->msg_type = g_strdup(value);
 }
 
-- 
1.9.3

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