summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorshdown <shdownnine@gmail.com>2014-08-30 13:03:30 +0400
committerwm4 <wm4@nowhere>2014-08-30 15:15:37 +0200
commit5bc3b7c3687e7e3f9a4b5c9053a2618a33712f4a (patch)
tree997decfba2c81cc2d72d6dffbd4c606d7464a03d /demux
parent593e5e4a25812662478d830e1effbc1bb5f3b97e (diff)
downloadmpv-5bc3b7c3687e7e3f9a4b5c9053a2618a33712f4a.tar.bz2
mpv-5bc3b7c3687e7e3f9a4b5c9053a2618a33712f4a.tar.xz
demux_disc: handle new_sh_stream() fail correctly
Break the cycle on fail. Old code was checking if sh is NULL after accessing it's fields.
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_disc.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/demux/demux_disc.c b/demux/demux_disc.c
index b3d4db30a8..5175f89e01 100644
--- a/demux/demux_disc.c
+++ b/demux/demux_disc.c
@@ -135,19 +135,21 @@ static void add_streams(demuxer_t *demuxer)
}
}
struct sh_stream *sh = new_sh_stream(demuxer, src->type);
+ if (!sh)
+ break;
assert(p->num_streams == n); // directly mapped
MP_TARRAY_APPEND(p, p->streams, p->num_streams, sh);
// Copy all stream fields that might be relevant
sh->codec = talloc_strdup(sh, src->codec);
sh->format = src->format;
sh->lav_headers = src->lav_headers;
- if (sh && src->video) {
+ if (src->video) {
double ar;
if (stream_control(demuxer->stream, STREAM_CTRL_GET_ASPECT_RATIO, &ar)
== STREAM_OK)
sh->video->aspect = ar;
}
- if (sh && src->audio)
+ if (src->audio)
sh->audio = src->audio;
}
reselect_streams(demuxer);