Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2005-04-17 19:50:52 +0400
committerTon Roosendaal <ton@blender.org>2005-04-17 19:50:52 +0400
commit8a02dc11decda40e67bf95a109645e8df4d80b7e (patch)
tree4554d4243dc816c4fb3c9d3c8b245064b65823b2
parentf919cf75f16d2da22cffb64e2b7b70e09d0e77ee (diff)
Patch provided by Andrea Weikert (elubie):
With a few tests I have discovered that when quitting Blender the filelist in SpaceFile doesn't get free'd. storage.c: I have replaced strdup for the relname member in BLI_builddir with BLI_strdup. and malloc with MEM_mallocN for the string member in BLI_addstrings(). filesel.c: Of course also had to replace free with MEM_freeN in freefilelist(). In freespacelist (space.c) I added call to freefilelist for the SPACE_FILE space type.
-rw-r--r--source/blender/blenlib/intern/storage.c8
-rw-r--r--source/blender/src/filesel.c4
-rw-r--r--source/blender/src/space.c2
3 files changed, 8 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/storage.c b/source/blender/blenlib/intern/storage.c
index 2b91542855f..2d72922ccf7 100644
--- a/source/blender/blenlib/intern/storage.c
+++ b/source/blender/blenlib/intern/storage.c
@@ -245,7 +245,7 @@ void BLI_builddir(char *dirname, char *relname)
if (dlink){
strcpy(buf+rellen,fname->d_name);
- dlink->name = strdup(buf);
+ dlink->name = BLI_strdup(buf);
if (dlink->name[0] == '.') {
if (dlink->name[1] == 0) seen_ = 1;
@@ -264,14 +264,14 @@ void BLI_builddir(char *dirname, char *relname)
if (seen_ == 0) { /* Cachefs PATCH */
dlink = (struct dirlink *)malloc(sizeof(struct dirlink));
strcpy(buf+rellen,"./.");
- dlink->name = strdup(buf);
+ dlink->name = BLI_strdup(buf);
BLI_addhead(dirbase,dlink);
newnum++;
}
if (seen__ == 0) { /* MAC PATCH */
dlink = (struct dirlink *)malloc(sizeof(struct dirlink));
strcpy(buf+rellen,"./..");
- dlink->name = strdup(buf);
+ dlink->name = BLI_strdup(buf);
BLI_addhead(dirbase,dlink);
newnum++;
}
@@ -407,7 +407,7 @@ void BLI_adddirstrings()
sprintf(buf,"%s %s %s %7s %s %s %10s %s", file->mode1, file->mode2, file->mode3, files[num].owner, files[num].date, files[num].time, size,
files[num].relname);
- files[num].string=malloc(strlen(buf)+1);
+ files[num].string=MEM_mallocN(strlen(buf)+1, "filestring");
if (files[num].string){
strcpy(files[num].string,buf);
}
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index 219783f54fc..f1c32dd17a1 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -681,9 +681,9 @@ void freefilelist(SpaceFile *sfile)
if (sfile->filelist==0) return;
for(; num>=0; num--){
- free(sfile->filelist[num].relname);
+ MEM_freeN(sfile->filelist[num].relname);
- if (sfile->filelist[num].string) free(sfile->filelist[num].string);
+ if (sfile->filelist[num].string) MEM_freeN(sfile->filelist[num].string);
}
free(sfile->filelist);
sfile->filelist= 0;
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 668e6d13715..6b3d5b2bd76 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -4317,6 +4317,8 @@ void freespacelist(ListBase *lb)
SpaceFile *sfile= (SpaceFile*) sl;
if(sfile->libfiledata)
BLO_blendhandle_close(sfile->libfiledata);
+ if(sfile->filelist)
+ freefilelist(sfile);
}
else if(sl->spacetype==SPACE_BUTS) {
SpaceButs *buts= (SpaceButs*) sl;