summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-04-09 13:41:35 +0100
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>2014-04-09 13:44:45 +0100
commitd347809a82e24057302f948269392e76aaacea10 (patch)
tree483796e31f7227557dc516c5425068a1c3f688e8
parentc78edf5afc73a420b0c0df2e726d0da44edd94a7 (diff)
downloadgstreamer-plugins-bad-d347809a82e24057302f948269392e76aaacea10.tar.gz
tsmux: catch alloc failure
While it will probably not trigger, it should silence a Coverity warning about the fail code path testing for NULLness before freeing, where the buffer was already dereferenced. It seems safest to keep that test, in case future goto fail statements happen to have a NULL buffer there. Coverity 1139851
-rw-r--r--gst/mpegtsmux/tsmux/tsmux.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/gst/mpegtsmux/tsmux/tsmux.c b/gst/mpegtsmux/tsmux/tsmux.c
index f4b74c9fd..27ab4290b 100644
--- a/gst/mpegtsmux/tsmux/tsmux.c
+++ b/gst/mpegtsmux/tsmux/tsmux.c
@@ -848,7 +848,7 @@ tsmux_section_write_packet (GstMpegTsSectionType * type,
GstBuffer *section_buffer;
GstBuffer *packet_buffer = NULL;
GstMemory *mem;
- guint8 *packet;
+ guint8 *packet = NULL;
guint8 *data;
gsize data_size = 0;
gsize payload_written;
@@ -882,6 +882,8 @@ tsmux_section_write_packet (GstMpegTsSectionType * type,
while (section->pi.stream_avail > 0) {
packet = g_malloc (TSMUX_PACKET_LENGTH);
+ if (!packet)
+ goto fail;
if (section->pi.packet_start_unit_indicator) {
/* Wee need room for a pointer byte */