diff options
author | Bastien Nocera <hadess@users.sourceforge.net> | 2006-07-17 18:31:24 +0000 |
---|---|---|
committer | Bastien Nocera <hadess@users.sourceforge.net> | 2006-07-17 18:31:24 +0000 |
commit | 98a50600acbf591c5ec1f0850f2b00d5420bb300 (patch) | |
tree | a9e8207f1ccf6f611ae4a0ca4458f3871e552ebf /src | |
parent | a9b246e55cf04072635d34f2bbd392bd85dab1dd (diff) | |
download | xine-lib-98a50600acbf591c5ec1f0850f2b00d5420bb300.tar.gz xine-lib-98a50600acbf591c5ec1f0850f2b00d5420bb300.tar.bz2 |
- avoid crashes when init_yuv_planes has one of its allocations failing
See http://bugzilla.gnome.org/show_bug.cgi?id=338833
CVS patchset: 8135
CVS date: 2006/07/17 18:31:24
Diffstat (limited to 'src')
-rw-r--r-- | src/xine-utils/color.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/xine-utils/color.c b/src/xine-utils/color.c index c667c678c..c5d42be9d 100644 --- a/src/xine-utils/color.c +++ b/src/xine-utils/color.c @@ -61,7 +61,7 @@ * instructions), these macros will automatically map to those special * instructions. * - * $Id: color.c,v 1.29 2006/06/20 00:35:08 dgp85 Exp $ + * $Id: color.c,v 1.30 2006/07/17 18:31:24 hadess Exp $ */ #include "xine_internal.h" @@ -164,6 +164,8 @@ void init_yuv_planes(yuv_planes_t *yuv_planes, int width, int height) { int plane_size; + memset (yuv_planes, 0, sizeof (yuv_planes)); + yuv_planes->row_width = width; yuv_planes->row_count = height; plane_size = yuv_planes->row_width * yuv_planes->row_count; @@ -179,9 +181,12 @@ void init_yuv_planes(yuv_planes_t *yuv_planes, int width, int height) { * This frees the memory used by the YUV planes. */ void free_yuv_planes(yuv_planes_t *yuv_planes) { - free(yuv_planes->y); - free(yuv_planes->u); - free(yuv_planes->v); + if (yuv_planes->y) + free(yuv_planes->y); + if (yuv_planes->u) + free(yuv_planes->u); + if (yuv_planes->v) + free(yuv_planes->v); } /* |