1. dont free/realoc if no_free is set.

2. free then malloc otherwise realloc might ALSO have to memcpy if it cant
resize the segment whihc means overhead we dont need/want.


SVN revision: 34441
This commit is contained in:
Carsten Haitzler 2008-05-03 06:38:45 +00:00
parent 14e2187305
commit 42facfffe6
1 changed files with 8 additions and 1 deletions

View File

@ -153,7 +153,14 @@ _evas_common_rgba_image_surface_alloc(Image_Entry *ie, int w, int h)
else
siz = w * h * sizeof(DATA32);
im->image.data = realloc(im->image.data, siz);
if (im->image.no_free)
im->image.data = malloc(siz);
else
{
// im->image.data = realloc(im->image.data, siz);
if (im->image.data) free(im->image.data);
im->image.data = malloc(siz);
}
if (im->image.data == NULL) return -1;
#ifdef HAVE_VALGRIND