Fix for memory leak in multires baker.

This commit is contained in:
Sergey Sharybin 2011-11-29 15:45:16 +00:00
parent 9c0f557b35
commit 587197c13f

@ -636,6 +636,13 @@ static void *init_normal_data(MultiresBakeRender *bkr, Image *UNUSED(ima))
return (void*)normal_data; return (void*)normal_data;
} }
static void free_normal_data(void *bake_data)
{
MNormalBakeData *normal_data= (MNormalBakeData*)bake_data;
MEM_freeN(normal_data);
}
static void apply_heights_data(void *bake_data) static void apply_heights_data(void *bake_data)
{ {
MHeightBakeData *height_data= (MHeightBakeData*)bake_data; MHeightBakeData *height_data= (MHeightBakeData*)bake_data;
@ -849,7 +856,7 @@ static void bake_images(MultiresBakeRender *bkr)
switch(bkr->mode) { switch(bkr->mode) {
case RE_BAKE_NORMALS: case RE_BAKE_NORMALS:
do_multires_bake(bkr, ima, apply_tangmat_callback, init_normal_data, NULL, NULL); do_multires_bake(bkr, ima, apply_tangmat_callback, init_normal_data, NULL, free_normal_data);
break; break;
case RE_BAKE_DISPLACEMENT: case RE_BAKE_DISPLACEMENT:
do_multires_bake(bkr, ima, apply_heights_callback, init_heights_data, do_multires_bake(bkr, ima, apply_heights_callback, init_heights_data,