diff options
author | Kent Mein <mein@cs.umn.edu> | 2006-10-27 22:24:10 +0400 |
---|---|---|
committer | Kent Mein <mein@cs.umn.edu> | 2006-10-27 22:24:10 +0400 |
commit | 76ff13de42aed62a70def3f54a61b6540af481ab (patch) | |
tree | 7bd81db2f8a1d2aab49eab35d836787fe04a62f6 /source/blender/blenloader | |
parent | 43dc73ce791b783281be5b0fc7e80c2be638fd95 (diff) |
more bugs found thanks to klockwork
all of these are just check a var to make sure it points to something before
using them.
Kent
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index 38b58d8794f..7ced7f74c7a 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -202,6 +202,9 @@ static WriteData *writedata_new(int file) /* XXX, see note about this in readfile.c, remove * once we have an xp lock - zr */ + + if (wd == NULL) return NULL; + wd->sdna= dna_sdna_from_data(DNAstr, DNAlen, 0); wd->file= file; @@ -213,6 +216,7 @@ static WriteData *writedata_new(int file) static void writedata_do_write(WriteData *wd, void *mem, int memlen) { + if ((wd == NULL) || wd->error || (mem == NULL) || memlen < 1) return; if (wd->error) return; /* memory based save */ @@ -288,6 +292,8 @@ static WriteData *bgnwrite(int file, MemFile *compare, MemFile *current, int wri { WriteData *wd= writedata_new(file); + if (wd == NULL) return NULL; + wd->compare= compare; wd->current= current; /* this inits comparing */ @@ -727,8 +733,10 @@ static void write_modifiers(WriteData *wd, ListBase *modbase) { ModifierData *md; + if (modbase == NULL) return; for (md=modbase->first; md; md= md->next) { ModifierTypeInfo *mti = modifierType_getInfo(md->type); + if (mti == NULL) return; writestruct(wd, DATA, mti->structName, 1, md); @@ -1828,6 +1836,12 @@ static char *get_runtime_path(char *exename) { return NULL; } else { char *path= MEM_mallocN(strlen(installpath)+strlen(PATHSEPERATOR)+strlen(exename)+1, "runtimepath"); + + if (path == NULL) { + MEM_freeN(installpath); + return NULL; + } + strcpy(path, installpath); strcat(path, PATHSEPERATOR); strcat(path, exename); |