rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded
authorMartin Storsjö <martin@martin.st>
Mon, 9 Mar 2015 21:14:19 +0000 (23:14 +0200)
committerMartin Storsjö <martin@martin.st>
Tue, 10 Mar 2015 07:58:41 +0000 (09:58 +0200)
commitcf402d6fa88acd647cdff993429583bec8a34fdc
tree106bdddf23ef104dc424002c09f80f0f62046d40
parentc83dd2d2a458075a58895c384372f57c1ec26276
rtpenc_mpegts: Set chain->rtp_ctx only after avformat_write_header succeeded

By making sure we at each time only have one pointer set, either a
local variable or one in the context, we avoid potential double frees
in the cleanup routines. If chain->rtp_ctx is set, it is closed by
calling avformat_write_trailer, but that shouldn't be called unless
avformat_write_header succeeded.

This issue was pointed out by Andreas Cadhalpun.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/rtpenc_mpegts.c