diff options
author | James Almer <jamrial@gmail.com> | 2019-10-19 17:58:35 +0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-10-20 03:29:36 +0300 |
commit | 31aafdac2404c5e01b21e53255db3fb5ed53c7c9 (patch) | |
tree | 21547c181e8b2d006fea7d50b7d1e2d037415742 /libavformat | |
parent | 90e37adab7fc88162d44dc68e510c3688d2de2f6 (diff) |
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>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/options.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavformat/options.c b/libavformat/options.c index c188c23506..e14510504f 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -144,15 +144,17 @@ static void avformat_get_context_defaults(AVFormatContext *s) AVFormatContext *avformat_alloc_context(void) { AVFormatContext *ic; + AVFormatInternal *internal; ic = av_malloc(sizeof(AVFormatContext)); if (!ic) return ic; - avformat_get_context_defaults(ic); - ic->internal = av_mallocz(sizeof(*ic->internal)); - if (!ic->internal) { - avformat_free_context(ic); + internal = av_mallocz(sizeof(*internal)); + if (!internal) { + av_free(ic); return NULL; } + avformat_get_context_defaults(ic); + ic->internal = internal; ic->internal->offset = AV_NOPTS_VALUE; ic->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE; ic->internal->shortest_end = AV_NOPTS_VALUE; |