View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000404 | Far Manager | Settings | public | 2007-12-03 01:31 | 2007-12-03 14:42 |
Reporter | alexmitin | Assigned To | alexy | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Fixed in Version | 1.80 alpha 1 | ||||
Summary | 0000404: Handle leak in CopyKeyTree() | ||||
Description | There is a handle leak in the CopyKeyTree() function. Steps to reproduce: 1) Put a breakpoint in CopyKeyTree() function. 2) Start FAR under debugger with the following command line: FAR.exe -U testuser 3) Step through the code and watch the value of "hDestKey" variable. File: registry.cpp Line: 515 Function: CopyKeyTree() Context: int CopyKeyTree(const wchar_t *Src,const wchar_t *Dest,const wchar_t *Skip) { HKEY hSrcKey,hDestKey; ... DWORD Disposition; if(RegCreateKeyExW(hRegRootKey,Dest,0,NULL,0,KEY_WRITE,NULL,&hDestKey,&Disposition)!=ERROR_SUCCESS) { ... for (I=0;;I++) { ... if(RegCreateKeyExW(hRegRootKey,strDestKeyName,0,NULL,0,KEY_WRITE,NULL,&hDestKey,&Disposition)!=ERROR_SUCCESS) break; CopyKeyTree(strSrcKeyName,strDestKeyName); } CloseRegKey(hSrcKey); CloseRegKey(hDestKey); return(TRUE); } Sample Call Stack ----------------- *1 Far.exe!CopyKeyTree(const wchar_t * Src=0x02fc0fa8, const wchar_t * Dest=0x02fc4f80, const wchar_t * Skip=0x00000000) 2 Far.exe!CopyKeyTree(const wchar_t * Src=0x02f72fa8, const wchar_t * Dest=0x02f78f80, const wchar_t * Skip=0x00000000) 3 Far.exe!CopyKeyTree(const wchar_t * Src=0x02f5efa8, const wchar_t * Dest=0x02f62fa8, const wchar_t * Skip=0x00000000) 4 Far.exe!CopyKeyTree(const wchar_t * Src=0x00538ba4, const wchar_t * Dest=0x02f4cfa8, const wchar_t * Skip=0x005393e8) 5 Far.exe!CopyGlobalSettings() 6 Far.exe!wmain(int Argc=3, wchar_t * * Argv=0x02ddef68) 7 Far.exe!__tmainCRTStartup() 8 Far.exe!wmainCRTStartup() Observations ============ The first call to RegCreateKeyExW() assigns the value to "hDestKey". The second call to RegCreateKeyExW() overrides the value of "hDestKey" without closing it first. | ||||
Additional Information | FAR 1.80.0.373 | ||||
Tags | No tags attached. | ||||
Build | 376 | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2007-12-03 01:31 | alexmitin | New Issue | |
2007-12-03 01:57 | vskirdin | Status | new => assigned |
2007-12-03 01:57 | vskirdin | Assigned To | => vskirdin |
2007-12-03 14:05 | alexy | Assigned To | vskirdin => alexy |
2007-12-03 14:42 | alexy | Build | => 376 |
2007-12-03 14:42 | alexy | Status | assigned => closed |
2007-12-03 14:42 | alexy | Note Added: 0000939 | |
2007-12-03 14:42 | alexy | Resolution | open => fixed |
2007-12-03 14:42 | alexy | Fixed in Version | => 1.80 alpha 1 |