From caaeb15318dbdd38344f15a8919540f188de5c46 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 16 Sep 2014 18:11:00 +0200 Subject: demux: gracefully handle packet allocation failures Now the packet allocation functions can fail. --- sub/dec_sub.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'sub/dec_sub.c') diff --git a/sub/dec_sub.c b/sub/dec_sub.c index cc608c3ca5..7a0f5eb408 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -400,8 +400,10 @@ static void add_sub_list(struct dec_sub *sub, int at, struct packet_list *subs) static void add_packet(struct packet_list *subs, struct demux_packet *pkt) { pkt = demux_copy_packet(pkt); - talloc_steal(subs, pkt); - MP_TARRAY_APPEND(subs, subs->packets, subs->num_packets, pkt); + if (pkt) { + talloc_steal(subs, pkt); + MP_TARRAY_APPEND(subs, subs->packets, subs->num_packets, pkt); + } } // Read all packets from the demuxer and decode/add them. Returns false if -- cgit v1.2.3