- Ancient resource leak (rev 2) where checkPackedFile would open a file and never close it.

- Running simulations missed freeing some variables.
This commit is contained in:
Campbell Barton 2009-08-01 06:27:40 +00:00
parent 0949d48d25
commit e60138117c
5 changed files with 21 additions and 3 deletions

@ -2189,7 +2189,7 @@ static void where_is_pose_bone(Object *ob, bPoseChannel *pchan, float ctime)
Mat4MulSerie(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL); Mat4MulSerie(pchan->pose_mat, tmat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
} }
else if(bone->flag & BONE_NO_SCALE) { else if(bone->flag & BONE_NO_SCALE) {
float orthmat[4][4], vec[3]; float orthmat[4][4];
/* get the official transform, but we only use the vector from it (optimize...) */ /* get the official transform, but we only use the vector from it (optimize...) */
Mat4MulSerie(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL); Mat4MulSerie(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);

@ -383,6 +383,8 @@ int checkPackedFile(char * filename, PackedFile * pf)
} }
} }
} }
close(file);
} }
} }

@ -289,7 +289,10 @@ short imb_savetarga(struct ImBuf * ibuf, char *name, int flags)
fildes = fopen(name,"wb"); fildes = fopen(name,"wb");
if (!fildes) return 0; if (!fildes) return 0;
if (fwrite(buf, 1, 18,fildes) != 18) return (0); if (fwrite(buf, 1, 18,fildes) != 18) {
fclose(fildes);
return (0);
}
if (ibuf->cmap){ if (ibuf->cmap){
for (i = 0 ; i<ibuf->maxcol ; i++){ for (i = 0 ; i<ibuf->maxcol ; i++){

@ -483,15 +483,18 @@ static void *read_file_data(char *filename, int *len_r)
data= MEM_mallocN(*len_r, "read_file_data"); data= MEM_mallocN(*len_r, "read_file_data");
if (!data) { if (!data) {
*len_r= -1; *len_r= -1;
fclose(fp);
return NULL; return NULL;
} }
if (fread(data, *len_r, 1, fp)!=1) { if (fread(data, *len_r, 1, fp)!=1) {
*len_r= -1; *len_r= -1;
MEM_freeN(data); MEM_freeN(data);
fclose(fp);
return NULL; return NULL;
} }
fclose(fp);
return data; return data;
} }

@ -747,6 +747,16 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area,
delete mousedevice; delete mousedevice;
mousedevice = NULL; mousedevice = NULL;
} }
if (rasterizer)
{
delete rasterizer;
rasterizer = NULL;
}
if (rendertools)
{
delete rendertools;
rendertools = NULL;
}
SND_DeviceManager::Unsubscribe(); SND_DeviceManager::Unsubscribe();
} while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME); } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);