From c9025a58e106355a3143cad26b4e1352b6acf0c3 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sat, 19 Oct 2013 19:21:53 +0200 Subject: [PATCH] token: Fix bug when creating empty token We always want to have a valid GstStructure in the token. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=710520 --- gst/rtsp-server/rtsp-token.c | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/gst/rtsp-server/rtsp-token.c b/gst/rtsp-server/rtsp-token.c index 26cf54e..f07f1c2 100644 --- a/gst/rtsp-server/rtsp-token.c +++ b/gst/rtsp-server/rtsp-token.c @@ -105,7 +105,16 @@ gst_rtsp_token_init (GstRTSPTokenImpl * token, GstStructure * structure) GstRTSPToken * gst_rtsp_token_new_empty (void) { - return gst_rtsp_token_new (NULL, NULL); + GstRTSPTokenImpl *token; + GstStructure *s; + + s = gst_structure_new_empty ("GstRTSPToken"); + g_return_val_if_fail (s != NULL, NULL); + + token = g_slice_new0 (GstRTSPTokenImpl); + gst_rtsp_token_init (token, s); + + return (GstRTSPToken *) token; } /** @@ -144,18 +153,16 @@ gst_rtsp_token_new (const gchar * firstfield, ...) GstRTSPToken * gst_rtsp_token_new_valist (const gchar * firstfield, va_list var_args) { - GstRTSPTokenImpl *token; + GstRTSPToken *token; GstStructure *s; g_return_val_if_fail (firstfield != NULL, NULL); - s = gst_structure_new_valist ("GstRTSPToken", firstfield, var_args); - g_return_val_if_fail (s != NULL, NULL); + token = gst_rtsp_token_new_empty (); + s = GST_RTSP_TOKEN_STRUCTURE (token); + gst_structure_set_valist (s, firstfield, var_args); - token = g_slice_new0 (GstRTSPTokenImpl); - gst_rtsp_token_init (token, s); - - return (GstRTSPToken *) token; + return token; } -- 2.7.4