From 3b71758aeaf5216b60f666680dbfa1d20e460797 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Mon, 1 Mar 2010 15:03:13 +0000 Subject: [PATCH] fix some more possible bad callocs SVN revision: 46699 --- legacy/evas/src/modules/engines/gl_common/evas_gl_image.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/legacy/evas/src/modules/engines/gl_common/evas_gl_image.c b/legacy/evas/src/modules/engines/gl_common/evas_gl_image.c index ef5d416927..0c97b5b5bb 100644 --- a/legacy/evas/src/modules/engines/gl_common/evas_gl_image.c +++ b/legacy/evas/src/modules/engines/gl_common/evas_gl_image.c @@ -123,7 +123,8 @@ evas_gl_common_image_new_from_copied_data(Evas_GL_Context *gc, int w, int h, DAT if (im->tex) evas_gl_common_texture_free(im->tex); im->tex = NULL; im->cs.no_free = 0; - im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); + if (im->im->cache_entry.h > 0) + im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); if ((data) && (im->cs.data)) memcpy(im->cs.data, data, im->im->cache_entry.h * sizeof(unsigned char *) * 2); break; @@ -165,7 +166,8 @@ evas_gl_common_image_new(Evas_GL_Context *gc, int w, int h, int alpha, int cspac // if (im->tex) evas_gl_common_texture_free(im->tex); im->tex = NULL; im->cs.no_free = 0; - im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); + if (im->im->cache_entry.h > 0) + im->cs.data = calloc(1, im->im->cache_entry.h * sizeof(unsigned char *) * 2); break; default: abort();