fix for a (probably harmless) bug in makesdna where 1 byte off the end of the buffer was used in a comparison.

also fixed a memory leak.
This commit is contained in:
Campbell Barton 2010-09-18 03:46:13 +00:00
parent 3e1ff2e590
commit d5e11d409f

@ -421,7 +421,11 @@ int preprocess_include(char *maindata, int len)
int a, newlen, comment = 0; int a, newlen, comment = 0;
char *cp, *temp, *md; char *cp, *temp, *md;
temp= MEM_mallocN(len, "preprocess_include"); /* note: len + 1, last character is a dummy to prevent
* comparisons using uninitialized memory */
temp= MEM_mallocN(len + 1, "preprocess_include");
temp[len]= ' ';
memcpy(temp, maindata, len); memcpy(temp, maindata, len);
// remove all c++ comments // remove all c++ comments
@ -1054,6 +1058,7 @@ int make_structDNA(char *baseDirectory, FILE *file)
MEM_freeN(names); MEM_freeN(names);
MEM_freeN(types); MEM_freeN(types);
MEM_freeN(typelens); MEM_freeN(typelens);
MEM_freeN(alphalens);
MEM_freeN(structs); MEM_freeN(structs);
if (debugSDNA > -1) printf("done.\n"); if (debugSDNA > -1) printf("done.\n");