mirror of https://git.videolan.org/git/ffmpeg.git
avformat/options: don't call avformat_free_context() within avformat_alloc_context()
avformat_free_context() expects AVFormatContext->internal to not be NULL. Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
parent
90e37adab7
commit
31aafdac24
|
@ -144,15 +144,17 @@ static void avformat_get_context_defaults(AVFormatContext *s)
|
||||||
AVFormatContext *avformat_alloc_context(void)
|
AVFormatContext *avformat_alloc_context(void)
|
||||||
{
|
{
|
||||||
AVFormatContext *ic;
|
AVFormatContext *ic;
|
||||||
|
AVFormatInternal *internal;
|
||||||
ic = av_malloc(sizeof(AVFormatContext));
|
ic = av_malloc(sizeof(AVFormatContext));
|
||||||
if (!ic) return ic;
|
if (!ic) return ic;
|
||||||
avformat_get_context_defaults(ic);
|
|
||||||
|
|
||||||
ic->internal = av_mallocz(sizeof(*ic->internal));
|
internal = av_mallocz(sizeof(*internal));
|
||||||
if (!ic->internal) {
|
if (!internal) {
|
||||||
avformat_free_context(ic);
|
av_free(ic);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
avformat_get_context_defaults(ic);
|
||||||
|
ic->internal = internal;
|
||||||
ic->internal->offset = AV_NOPTS_VALUE;
|
ic->internal->offset = AV_NOPTS_VALUE;
|
||||||
ic->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
|
ic->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
|
||||||
ic->internal->shortest_end = AV_NOPTS_VALUE;
|
ic->internal->shortest_end = AV_NOPTS_VALUE;
|
||||||
|
|
Loading…
Reference in New Issue