aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2013-03-15 21:20:37 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-19 11:18:42 +0100
commit4e70d66ded537cadd32dbd02a38c3d86a203c812 (patch)
tree1f16ca0852801acfa12477a6f330fef189b12da5 /libavcodec
parent1516bf7af1e8647962738f590be0a5ea1a553afd (diff)
downloadffmpeg-4e70d66ded537cadd32dbd02a38c3d86a203c812.tar.gz
mpegvideo: fix allocation of the hwaccel_picture_private data
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegvideo.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index 9048179c74..ae6cdefe6b 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -269,11 +269,12 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
if (s->avctx->hwaccel) {
assert(!pic->hwaccel_picture_private);
if (s->avctx->hwaccel->priv_data_size) {
- pic->hwaccel_picture_private = av_mallocz(s->avctx->hwaccel->priv_data_size);
- if (!pic->hwaccel_picture_private) {
+ pic->hwaccel_priv_buf = av_buffer_allocz(s->avctx->hwaccel->priv_data_size);
+ if (!pic->hwaccel_priv_buf) {
av_log(s->avctx, AV_LOG_ERROR, "alloc_frame_buffer() failed (hwaccel private data allocation)\n");
return -1;
}
+ pic->hwaccel_picture_private = pic->hwaccel_priv_buf->data;
}
}
@@ -293,7 +294,8 @@ static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
if (r < 0 || !pic->f.data[0]) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed (%d %p)\n",
r, pic->f.data[0]);
- av_freep(&pic->hwaccel_picture_private);
+ av_buffer_unref(&pic->hwaccel_priv_buf);
+ pic->hwaccel_picture_private = NULL;
return -1;
}