avcodec/pthread_frame: Simplify code by using av_reallocp_array()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-11-01 10:51:08 +01:00
parent cc769931ab
commit 842745fe17
1 changed files with 4 additions and 7 deletions

View File

@ -286,13 +286,10 @@ FF_ENABLE_DEPRECATION_WARNINGS
if (src->slice_count && src->slice_offset) {
if (dst->slice_count < src->slice_count) {
int *tmp = av_realloc(dst->slice_offset, src->slice_count *
sizeof(*dst->slice_offset));
if (!tmp) {
av_free(dst->slice_offset);
return AVERROR(ENOMEM);
}
dst->slice_offset = tmp;
int err = av_reallocp_array(&dst->slice_offset, src->slice_count,
sizeof(*dst->slice_offset));
if (err < 0)
return err;
}
memcpy(dst->slice_offset, src->slice_offset,
src->slice_count * sizeof(*dst->slice_offset));