Mercurial > mplayer.hg
changeset 36512:8057935cd9e0
vo_bl: Simplify realloc + memset to calloc.
Also remove a condition that obviously cannot be true.
author | reimar |
---|---|
date | Sat, 18 Jan 2014 13:59:00 +0000 |
parents | 6e88ef2077a4 |
children | fe7d63062afb |
files | libvo/vo_bl.c |
diffstat | 1 files changed, 4 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/libvo/vo_bl.c Sat Jan 18 13:55:52 2014 +0000 +++ b/libvo/vo_bl.c Sat Jan 18 13:59:00 2014 +0000 @@ -247,14 +247,14 @@ } /* resize or allocate frame and tmp buffers */ - ptr = realloc(bl_packet, bl_size); /* space for header and image data */ - if (!ptr) { + free(bl_packet); + bl_packet = calloc(bl_size, 1); /* space for header and image data */ + if (!bl_packet) { mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n"); goto err_out; } - bl_packet = ptr; + image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ - image = ((unsigned char*)bl_packet + 12); /* pointer to image data */ ptr = realloc(tmp, bl_size); /* space for image data only, could be slightly smaller */ if (!ptr) { mp_msg(MSGT_VO, MSGL_ERR, "bl: out of memory error\n"); @@ -281,11 +281,6 @@ mp_msg(MSGT_VO, MSGL_ERR, "bl: height of movie too large %d > %d\n", height, bl->height); goto err_out; } - if (!image) { - mp_msg(MSGT_VO, MSGL_ERR, "bl: image should be initialized, internal error\n"); - goto err_out; - } - memset(image, 0, bl_size - 12); /* blank the image */ mp_msg(MSGT_VO, MSGL_V, "vo_config bl called\n"); return 0; err_out: