void
gst_mpegts_dvb_linkage_descriptor_free (GstMpegtsDVBLinkageDescriptor * source)
{
- switch (source->linkage_type) {
- case GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER:
- g_slice_free (GstMpegtsDVBLinkageMobileHandOver, source->linkage_data);
- break;
- case GST_MPEGTS_DVB_LINKAGE_EVENT:
- g_slice_free (GstMpegtsDVBLinkageEvent, source->linkage_data);
- break;
- case GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT:
- g_ptr_array_unref (source->linkage_data);
- break;
- default:
- break;
- }
+ if (source->linkage_data)
+ switch (source->linkage_type) {
+ case GST_MPEGTS_DVB_LINKAGE_MOBILE_HAND_OVER:
+ g_slice_free (GstMpegtsDVBLinkageMobileHandOver, source->linkage_data);
+ break;
+ case GST_MPEGTS_DVB_LINKAGE_EVENT:
+ g_slice_free (GstMpegtsDVBLinkageEvent, source->linkage_data);
+ break;
+ case GST_MPEGTS_DVB_LINKAGE_EXTENDED_EVENT:
+ g_ptr_array_unref (source->linkage_data);
+ break;
+ default:
+ break;
+ }
- g_slice_free1 (source->private_data_length, source->private_data_bytes);
+ if (source->private_data_bytes)
+ g_slice_free1 (source->private_data_length, source->private_data_bytes);
g_slice_free (GstMpegtsDVBLinkageDescriptor, source);
}
GstMpegtsDVBLinkageMobileHandOver *hand_over;
if (end - data < 1)
- return FALSE;
+ goto fail;
hand_over = g_slice_new0 (GstMpegtsDVBLinkageMobileHandOver);
res->linkage_data = (gpointer) hand_over;
GST_MPEGTS_DVB_LINKAGE_HAND_OVER_LOCAL_VARIATION
|| hand_over->hand_over_type ==
GST_MPEGTS_DVB_LINKAGE_HAND_OVER_ASSOCIATED) {
- if (end - data < 2) {
- g_slice_free (GstMpegtsDVBLinkageMobileHandOver, hand_over);
- res->linkage_data = NULL;
- return FALSE;
- }
+ if (end - data < 2)
+ goto fail;
hand_over->network_id = GST_READ_UINT16_BE (data);
data += 2;
}
if (hand_over->origin_type == 0) {
- if (end - data < 2) {
- g_slice_free (GstMpegtsDVBLinkageMobileHandOver, hand_over);
- res->linkage_data = NULL;
- return FALSE;
- }
+ if (end - data < 2)
+ goto fail;
hand_over->initial_service_id = GST_READ_UINT16_BE (data);
data += 2;
GstMpegtsDVBLinkageEvent *event;
if (end - data < 3)
- return FALSE;
+ goto fail;
event = g_slice_new0 (GstMpegtsDVBLinkageEvent);
res->linkage_data = (gpointer) event;
return TRUE;
fail:
- g_ptr_array_unref (res->linkage_data);
- res->linkage_data = NULL;
+ gst_mpegts_dvb_linkage_descriptor_free (res);
return FALSE;
}