[PATCH BlueZ 2/2] obexd/mns: Check event value is valid

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

 



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

This adds a common check before passing the event value to the callback.
---
 obexd/client/mns.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/obexd/client/mns.c b/obexd/client/mns.c
index 124dbcf..76b7d1c 100644
--- a/obexd/client/mns.c
+++ b/obexd/client/mns.c
@@ -191,9 +191,6 @@ static void parse_event_report_handle(struct map_event *event,
 static void parse_event_report_folder(struct map_event *event,
 							const char *value)
 {
-	if (!value)
-		return;
-
 	g_free(event->folder);
 
 	if (g_str_has_prefix(value, "/"))
@@ -205,9 +202,6 @@ static void parse_event_report_folder(struct map_event *event,
 static void parse_event_report_old_folder(struct map_event *event,
 							const char *value)
 {
-	if (!value)
-		return;
-
 	g_free(event->old_folder);
 
 	if (g_str_has_prefix(value, "/"))
@@ -219,9 +213,6 @@ 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);
 }
@@ -256,7 +247,8 @@ static void event_report_element(GMarkupParseContext *ctxt,
 		for (parser = event_report_parsers; parser && parser->name;
 								parser++) {
 			if (strcasecmp(key, parser->name) == 0) {
-				parser->func(event, values[i]);
+				if (values[i])
+					parser->func(event, values[i]);
 				break;
 			}
 		}
-- 
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