winnt-initialize-variables-and-memory-before-use-20010906

initialize a variable false when assumed; also some memset(...,0
This commit is contained in:
Walter Wong 2001-09-07 04:32:56 +00:00 committed by Derrick Brashear
parent 11b021e1b1
commit 653b001612
3 changed files with 6 additions and 1 deletions

View File

@ -398,7 +398,7 @@ BOOL AfsClass_RestartService (LPIDENT lpiRestart, ULONG *pStatus)
lpServer->Close();
}
BOOL fRestartAll;
BOOL fRestartAll = FALSE;
if (!lpiRestart->fIsService())
fRestartAll = TRUE;

View File

@ -129,6 +129,7 @@ cm_space_t *cm_GetSpace(void)
cm_spaceListp = tsp->nextp;
}
else tsp = (cm_space_t *) malloc(sizeof(cm_space_t));
(void) memset(tsp, 0, sizeof(cm_space_t);
lock_ReleaseWrite(&cm_utilsLock);
return tsp;

View File

@ -149,6 +149,10 @@ void smb_IoctlPrepareWrite(smb_fid_t *fidp, smb_ioctl_t *ioctlp)
if (!ioctlp->inAllocp) ioctlp->inAllocp = malloc(SMB_IOCTL_MAXDATA);
if (!ioctlp->outAllocp) ioctlp->outAllocp = malloc(SMB_IOCTL_MAXDATA);
/* Fixes fs la problem. We do a StrToOEM later and if this data isn't initialized we get memory issues. */
(void) memset(ioctlp->inAllocp, 0, SMB_IOCTL_MAXDATA);
(void) memset(ioctlp->outAllocp, 0, SMB_IOCTL_MAXDATA);
/* and make sure that we've reset our state for the new incoming request */
if (!(ioctlp->flags & SMB_IOCTLFLAG_DATAIN)) {
ioctlp->inCopied = 0;