rtsp: free the right string.
authorWim Taymans <wim.taymans@collabora.co.uk>
Wed, 11 Mar 2009 13:08:10 +0000 (14:08 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Wed, 11 Mar 2009 13:09:54 +0000 (14:09 +0100)
Free the key value before we remove the header item from the array. The item we
retrieved from the array is only valid until we remove it from the array.

gst-libs/gst/rtsp/gstrtspmessage.c

index 5df3fbf..9fde2e2 100644 (file)
@@ -563,8 +563,8 @@ gst_rtsp_message_remove_header (GstRTSPMessage * msg, GstRTSPHeaderField field,
     RTSPKeyValue *key_value = &g_array_index (msg->hdr_fields, RTSPKeyValue, i);
 
     if (key_value->field == field && (indx == -1 || cnt++ == indx)) {
-      g_array_remove_index (msg->hdr_fields, i);
       g_free (key_value->value);
+      g_array_remove_index (msg->hdr_fields, i);
       res = GST_RTSP_OK;
       if (indx != -1)
         break;