From 93b60df9ac6e6de1159b7c7cf16f1547c1931de5 Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Thu, 13 Jul 2006 14:02:16 +0000 Subject: [PATCH] gdp: fix failure to deserialize event packets with empty payload (only ev... Original commit message from CVS: * libs/gst/dataprotocol/dataprotocol.c: (gst_dp_event_from_packet_1_0): Fixes #347337: failure to deserialize event packets with empty payload (only event type) --- gst/gdp/dataprotocol.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/gst/gdp/dataprotocol.c b/gst/gdp/dataprotocol.c index 887b2eeb72..dd290cc017 100644 --- a/gst/gdp/dataprotocol.c +++ b/gst/gdp/dataprotocol.c @@ -659,15 +659,16 @@ gst_dp_event_from_packet_1_0 (guint header_length, const guint8 * header, { GstEvent *event = NULL; GstEventType type; - gchar *string; - GstStructure *s; + gchar *string = NULL; + GstStructure *s = NULL; type = GST_DP_HEADER_PAYLOAD_TYPE (header) - GST_DP_PAYLOAD_EVENT_NONE; - string = g_strndup ((gchar *) payload, GST_DP_HEADER_PAYLOAD_LENGTH (header)); - s = gst_structure_from_string (string, NULL); - g_free (string); - if (!s) - return NULL; + if (payload) { + string = + g_strndup ((gchar *) payload, GST_DP_HEADER_PAYLOAD_LENGTH (header)); + s = gst_structure_from_string (string, NULL); + g_free (string); + } event = gst_event_new_custom (type, s); return event; }