summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 734f83f1cd..bb17b4aedd 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2460,6 +2460,8 @@ static void free_stream(AVStream **pst)
if (st->attached_pic.data)
av_packet_unref(&st->attached_pic);
+ av_freep(&st->internal);
+
av_dict_free(&st->metadata);
av_freep(&st->probe_data.buf);
av_free(st->index_entries);
@@ -2551,6 +2553,11 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
av_free(st);
return NULL;
}
+
+ st->internal = av_mallocz(sizeof(*st->internal));
+ if (!st->internal)
+ goto fail;
+
if (s->iformat) {
/* no default bitrate if decoding */
st->codec->bit_rate = 0;
@@ -2583,6 +2590,9 @@ AVStream *avformat_new_stream(AVFormatContext *s, const AVCodec *c)
s->streams[s->nb_streams++] = st;
return st;
+fail:
+ free_stream(&st);
+ return NULL;
}
AVProgram *av_new_program(AVFormatContext *ac, int id)