aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-10-15 23:23:49 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-10-15 23:23:53 +0200
commitf09162c06bbafc4801c5a63a5abc6ce37d8881bd (patch)
tree6a62668e59c92b5610a6d82c7879dc5d31d08b1b
parent60a876fe7b50935749200ae7f387e7f251b1a856 (diff)
parentced7238cd01cc2199acf9225305628641a27c1d7 (diff)
downloadffmpeg-f09162c06bbafc4801c5a63a5abc6ce37d8881bd.tar.gz
Merge commit 'ced7238cd01cc2199acf9225305628641a27c1d7'
* commit 'ced7238cd01cc2199acf9225305628641a27c1d7': rtpdec_hevc: Use av_realloc instead of av_malloc+memcpy Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/rtpdec_hevc.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/libavformat/rtpdec_hevc.c b/libavformat/rtpdec_hevc.c
index 2ee233ddfb..f677733a0a 100644
--- a/libavformat/rtpdec_hevc.c
+++ b/libavformat/rtpdec_hevc.c
@@ -124,24 +124,20 @@ static av_cold int hevc_sdp_parse_fmtp_config(AVFormatContext *s,
decoded_packet_size = av_base64_decode(decoded_packet, base64packet,
sizeof(decoded_packet));
if (decoded_packet_size > 0) {
- uint8_t *dest = av_malloc(decoded_packet_size +
+ uint8_t *tmp = av_realloc(*data_ptr, decoded_packet_size +
sizeof(start_sequence) + *size_ptr);
- if (!dest) {
+ if (!tmp) {
av_log(s, AV_LOG_ERROR,
"Unable to allocate memory for extradata!\n");
return AVERROR(ENOMEM);
}
- if (*size_ptr) {
- memcpy(dest, *data_ptr, *size_ptr);
- av_free(*data_ptr);
- }
+ *data_ptr = tmp;
- memcpy(dest + *size_ptr, start_sequence,
+ memcpy(*data_ptr + *size_ptr, start_sequence,
sizeof(start_sequence));
- memcpy(dest + *size_ptr + sizeof(start_sequence),
+ memcpy(*data_ptr + *size_ptr + sizeof(start_sequence),
decoded_packet, decoded_packet_size);
- *data_ptr = dest;
*size_ptr += sizeof(start_sequence) + decoded_packet_size;
}
}