windows-scache-ref-leak-20061008

plug two more scache refcount leaks
This commit is contained in:
Jeffrey Altman 2006-10-08 21:30:03 +00:00
parent c97374d6fd
commit 7231e2efe6
4 changed files with 41 additions and 11 deletions

View File

@ -1234,6 +1234,13 @@ int afsd_InitCM(char **reasonP)
return 0;
}
int afsd_ShutdownCM(void)
{
cm_ReleaseSCache(&cm_data.rootSCachep);
return 0;
}
int afsd_InitDaemons(char **reasonP)
{
long code;

View File

@ -14,6 +14,7 @@ int afsd_InitSMB(char **reasonP, void *aMBfunc);
void GenerateMiniDump(PEXCEPTION_POINTERS ep);
int afsd_InitDaemons(char **reasonP);
int afsd_ShutdownCM(void);
void afsd_ForceTrace(BOOL flush);
void afsd_SetUnhandledExceptionFilter();

View File

@ -1401,7 +1401,9 @@ afsd_Main(DWORD argc, LPTSTR *argv)
cm_DaemonShutdown();
afsi_log("Daemon shutdown complete");
afsd_ShutdownCM();
buf_Shutdown();
afsi_log("Buffer shutdown complete");
@ -1409,7 +1411,7 @@ afsd_Main(DWORD argc, LPTSTR *argv)
afsi_log("rx finalization complete");
#ifndef AFSIFS
smb_Shutdown();
smb_Shutdown();
afsi_log("smb shutdown complete");
#endif

View File

@ -199,7 +199,7 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
{
long code;
#ifndef AFSIFS
cm_scache_t *substRootp;
cm_scache_t *substRootp = NULL;
#endif
char * relativePath = ioctlp->inDatap;
@ -223,8 +223,10 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
userp, "", reqp, scpp);
if (code)
return code;
if (code) {
osi_Log1(afsd_logp,"cm_ParseIoctlPath code 0x%x", code);
return code;
}
#else /* AFSIFS */
if (relativePath[0] == relativePath[1] &&
relativePath[1] == '\\' &&
@ -257,13 +259,17 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
userp, sharePath, reqp, &substRootp);
free(sharePath);
if (code)
if (code) {
osi_Log1(afsd_logp,"cm_ParseIoctlPath [1] code 0x%x", code);
return code;
}
code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
userp, NULL, reqp, scpp);
if (code)
if (code) {
osi_Log1(afsd_logp,"cm_ParseIoctlPath [2] code 0x%x", code);
return code;
}
} else {
/* otherwise, treat the name as a cellname mounted off the afs root.
* This requires that we reconstruct the shareName string with
@ -285,25 +291,35 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
code = cm_NameI(cm_data.rootSCachep, ioctlp->prefix->data,
CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
userp, shareName, reqp, &substRootp);
if (code)
if (code) {
osi_Log1(afsd_logp,"cm_ParseIoctlPath [3] code 0x%x", code);
return code;
}
code = cm_NameI(substRootp, p, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
userp, NULL, reqp, scpp);
if (code)
if (code) {
cm_ReleaseSCache(substRootp);
osi_Log1(afsd_logp,"cm_ParseIoctlPath code [4] 0x%x", code);
return code;
}
}
} else {
code = cm_NameI(cm_data.rootSCachep, ioctlp->prefix->data,
CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
userp, ioctlp->tidPathp, reqp, &substRootp);
if (code)
if (code) {
osi_Log1(afsd_logp,"cm_ParseIoctlPath [6] code 0x%x", code);
return code;
}
code = cm_NameI(substRootp, relativePath, CM_FLAG_CASEFOLD | CM_FLAG_FOLLOW,
userp, NULL, reqp, scpp);
if (code)
if (code) {
cm_ReleaseSCache(substRootp);
osi_Log1(afsd_logp,"cm_ParseIoctlPath [7] code 0x%x", code);
return code;
}
}
#endif /* AFSIFS */
@ -314,7 +330,11 @@ long cm_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
/* This is usually nothing, but for StatMountPoint it is the file name. */
TranslateExtendedChars(ioctlp->inDatap);
if (substRootp)
cm_ReleaseSCache(substRootp);
/* and return success */
osi_Log1(afsd_logp,"cm_ParseIoctlPath [8] code 0x%x", code);
return 0;
}