- Ancient resource leak (rev 2) where checkPackedFile would open a file and never...
authorCampbell Barton <ideasman42@gmail.com>
Sat, 1 Aug 2009 06:27:40 +0000 (06:27 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 1 Aug 2009 06:27:40 +0000 (06:27 +0000)
- Running simulations missed freeing some variables.

source/blender/blenkernel/intern/armature.c
source/blender/blenkernel/intern/packedFile.c
source/blender/imbuf/intern/targa.c
source/blender/makesdna/intern/makesdna.c
source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp

index 155d5a7d21c791c143f793d4f235b159aef8af87..1577eb4f850740830ae9caf30516bb351888f37b 100644 (file)
@@ -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);
                }
                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...) */
                        Mat4MulSerie(pchan->pose_mat, parchan->pose_mat, offs_bone, pchan->chan_mat, NULL, NULL, NULL, NULL, NULL);
index f6a65bd72a5d20f103ecb16fae641549b57da6d2..d0925a641e3f5a0d09ef52844995eb74fee1bb77 100644 (file)
@@ -383,6 +383,8 @@ int checkPackedFile(char * filename, PackedFile * pf)
                                        }
                                }
                        }
+                       
+                       close(file);
                }
        }
        
index 303e5685503418ccf140a429f9b2b12feeb540ce..6a974464f5627673e500f9e1402aae09d7448ca4 100644 (file)
@@ -289,7 +289,10 @@ short imb_savetarga(struct ImBuf * ibuf, char *name, int flags)
        fildes = fopen(name,"wb");
         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){
                for (i = 0 ; i<ibuf->maxcol ; i++){
index b4deb1f2b6065b331359c25a580d0911a6eb9d83..7529f2140a587d7e09debd00a0afe5121fdb0058 100644 (file)
@@ -483,15 +483,18 @@ static void *read_file_data(char *filename, int *len_r)
        data= MEM_mallocN(*len_r, "read_file_data");
        if (!data) {
                *len_r= -1;
+               fclose(fp);
                return NULL;
        }
 
        if (fread(data, *len_r, 1, fp)!=1) {
                *len_r= -1;
                MEM_freeN(data);
+               fclose(fp);
                return NULL;
        }
-
+       
+       fclose(fp);
        return data;
 }
 
index 0ed8682c092aa2aeda3b21a5ad03f3b2c4152cad..b200fc8614b0f07bc755523552536e2923ccbc79 100644 (file)
@@ -747,6 +747,16 @@ extern "C" void StartKetsjiShellSimulation(struct ScrArea *area,
                        delete mousedevice;
                        mousedevice = NULL;
                }
+               if (rasterizer)
+               {
+                       delete rasterizer;
+                       rasterizer = NULL;
+               }
+               if (rendertools)
+               {
+                       delete rendertools;
+                       rendertools = NULL;
+               }
                SND_DeviceManager::Unsubscribe();
 
        } while (exitrequested == KX_EXIT_REQUEST_RESTART_GAME || exitrequested == KX_EXIT_REQUEST_START_OTHER_GAME);