Commit 328a5b93 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '06ebc0bf'

* commit '06ebc0bf':
  lavf: Allocate arrays with av_realloc if they will be realloced later
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 47c5c942 06ebc0bf
...@@ -74,7 +74,7 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags) ...@@ -74,7 +74,7 @@ static av_cold int concat_open(URLContext *h, const char *uri, int flags)
return AVERROR(ENAMETOOLONG); return AVERROR(ENAMETOOLONG);
} }
if (!(nodes = av_malloc(sizeof(*nodes) * len))) { if (!(nodes = av_realloc(NULL, sizeof(*nodes) * len))) {
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} else } else
data->nodes = nodes; data->nodes = nodes;
......
...@@ -179,7 +179,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, ...@@ -179,7 +179,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
} else { } else {
av_freep(&qt->pkt.data); av_freep(&qt->pkt.data);
av_init_packet(&qt->pkt); av_init_packet(&qt->pkt);
qt->pkt.data = av_malloc(alen + FF_INPUT_BUFFER_PADDING_SIZE); qt->pkt.data = av_realloc(NULL, alen + FF_INPUT_BUFFER_PADDING_SIZE);
if (!qt->pkt.data) if (!qt->pkt.data)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
qt->pkt.size = 0; qt->pkt.size = 0;
...@@ -213,7 +213,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt, ...@@ -213,7 +213,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
pkt->stream_index = st->index; pkt->stream_index = st->index;
if (qt->remaining > 0) { if (qt->remaining > 0) {
av_freep(&qt->pkt.data); av_freep(&qt->pkt.data);
qt->pkt.data = av_malloc(qt->remaining * qt->bytes_per_frame); qt->pkt.data = av_realloc(NULL, qt->remaining * qt->bytes_per_frame);
if (!qt->pkt.data) { if (!qt->pkt.data) {
av_free_packet(pkt); av_free_packet(pkt);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment