summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-16 18:11:00 +0200
committerwm4 <wm4@nowhere>2014-09-16 18:11:00 +0200
commitcaaeb15318dbdd38344f15a8919540f188de5c46 (patch)
treee0416e67067fcbb4485d96deaacd7dd55f55a51e /sub
parent26e0cce9699e672b3d56c3b184a662955c4815bc (diff)
downloadmpv-caaeb15318dbdd38344f15a8919540f188de5c46.tar.bz2
mpv-caaeb15318dbdd38344f15a8919540f188de5c46.tar.xz
demux: gracefully handle packet allocation failures
Now the packet allocation functions can fail.
Diffstat (limited to 'sub')
-rw-r--r--sub/dec_sub.c6
1 files changed, 4 insertions, 2 deletions
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