- MAJOR FIX: MRes.c: replaced mallocs with callocs in MResAdjustDRes() to scrub the {C|J|O|N}RE variables. Code in that function depends on it, and breaks badly with glic memory corruption errors when RESERVATIONDEPTH is > 1. Further auditing of malloc vs. calloc is probably needed across the entire codebase.

- MSU.c: Fix for valgrind error about uninitialized value

- MNode.c: Fix for valgrind error about uninitialized value


git-svn-id: svn://opensvn.adaptivecomputing.com/maui/trunk@142 3f5042e3-fb1d-0410-be18-d6ca2573e517
This commit is contained in:
jasonw 2010-08-03 21:21:42 +00:00
parent 992e0a16af
commit 8ed8a5727c
3 changed files with 19 additions and 9 deletions

View File

@ -956,6 +956,9 @@ int MSUSendData(
#endif /* !__MPROD */
/* initialize */
TSLine[0]='\0';
CKLine[0]='\0';
SHeader[0]='\0';
tmpSBuf[0] = '\0'; /* tmpSBuf is global (not threadsafe) */

View File

@ -5746,10 +5746,11 @@ int MNodeGetLocation(
int nindex;
char tmpName[MAX_MNAME];
tmpName[0]='\0';
char *ptr;
long Address;
long Address=0;
mhost_t *S;

View File

@ -7137,14 +7137,20 @@ int MResAdjustDRes(
{
memset(&ZRes,0,sizeof(ZRes));
if (CRE == NULL )
CRE = (mre_t *)malloc(sizeof(mre_t) * (MSched.ResDepth << 1));
if (ORE == NULL )
ORE = (mre_t *)malloc(sizeof(mre_t) * (MSched.ResDepth << 1));
if (NRE == NULL )
NRE = (mre_t *)malloc(sizeof(mre_t) * (MSched.ResDepth << 1));
if (JRE == NULL )
JRE = (mre_t *)malloc(sizeof(mre_t) * (MSched.ResDepth << 1));
/* changed the mallocs to callocs because there is code below */
/* that requires things to be zero'ed */
if (CRE == NULL ) {
CRE = (mre_t *)calloc((MSched.ResDepth << 1),sizeof(mre_t));
}
if (ORE == NULL ){
ORE = (mre_t *)calloc((MSched.ResDepth << 1),sizeof(mre_t));
}
if (NRE == NULL ){
NRE = (mre_t *)calloc((MSched.ResDepth << 1),sizeof(mre_t));
}
if (JRE == NULL ){
JRE = (mre_t *)calloc((MSched.ResDepth << 1),sizeof(mre_t));
}
DRSize = sizeof(mcres_t);
} /* END if (CRE == NULL) */