From 224cb81b8fcbf03df5e07f045ecb9ecf64189400 Mon Sep 17 00:00:00 2001 From: Vincent Penquerc'h Date: Wed, 9 Apr 2014 15:44:10 +0100 Subject: [PATCH] mpegts: test for allocation failure While it's unlikely to get there, it silences the coverity warning on the error code path that we test for NULL before freeing, when all branches there are from locations where pmt cannot be NULL, and removing the NULL check makes the code more vulnerable to a hypothetical future branch from somewhere where it can be. Coverity 1139852 --- gst-libs/gst/mpegts/gstmpegtssection.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gst-libs/gst/mpegts/gstmpegtssection.c b/gst-libs/gst/mpegts/gstmpegtssection.c index 4913095eb5..41289d6c7d 100644 --- a/gst-libs/gst/mpegts/gstmpegtssection.c +++ b/gst-libs/gst/mpegts/gstmpegtssection.c @@ -657,6 +657,10 @@ _parse_pmt (GstMpegTsSection * section) guint stream_info_length; pmt = g_slice_new0 (GstMpegTsPMT); + if (!pmt) { + GST_WARNING ("Failed to allocate PMT structure"); + goto error; + } data = section->data; end = data + section->section_length;