Leakage Problem , please check code
- From: Akın ÖCal <AknCal@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 3 Jul 2007 02:44:01 -0700
I am doing everything for allocating and freeing sid structure but it always
gives leakages please check the code :
BOOL GetAll (char* sFileOrFolderName )
{
DWORD dwRtnCode = 0;
PSID ownerSid = NULL;
HANDLE hFile;
hFile = CreateFile(
sFileOrFolderName,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
return FALSE;
}
dwRtnCode = GetSecurityInfo(
hFile,
SE_FILE_OBJECT,
OWNER_SECURITY_INFORMATION,
(&ownerSid),
NULL,
NULL,
NULL,
NULL);
if( !ownerSid )
{
CloseHandle(hFile);
return FALSE;
}
LocalFree((HLOCAL)ownerSid);
CloseHandle(hFile);
return TRUE ;
}
int _tmain(int argc, _TCHAR* argv[])
{
while(1)
{
if(!GetAll("d:\\aa.txt"))
{
printf("\nFailed");
}
Sleep(1000);
}
return 0;
}
.
- Follow-Ups:
- Re: Leakage Problem , please check code
- From: Scherbina Vladimir
- Re: Leakage Problem , please check code
- Prev by Date: Re: PS/2
- Next by Date: Re: Privilege Problem
- Previous by thread: Re: PS/2
- Next by thread: Re: Leakage Problem , please check code
- Index(es):
Relevant Pages
|