rdt: Check the return value of avformat_open

If it failed, return NULL. This avoids trying to use an
half-initialized RDTDemuxContext.

Signed-off-by: Martin Storsjö <martin@martin.st>
This commit is contained in:
Martin Storsjö 2011-11-06 23:51:19 +02:00
parent 4b3dc857e4
commit ed307e2659

View File

@ -524,7 +524,11 @@ rdt_new_context (void)
{
PayloadContext *rdt = av_mallocz(sizeof(PayloadContext));
avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);
int ret = avformat_open_input(&rdt->rmctx, "", &ff_rdt_demuxer, NULL);
if (ret < 0) {
av_free(rdt);
return NULL;
}
return rdt;
}