mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Fix a memory leak in Windows f_open.
The UCS-2 translation of the access-mode string ("r", "wb" etc) was not being freed, because the free call appeared after an unconditional return statement. Spotted by Coverity, although now I wonder why an ordinary compiler warning hadn't long since pointed this one out!
This commit is contained in:
parent
19d479d684
commit
41473d915b
@ -87,6 +87,7 @@ char filename_char_sanitise(char c)
|
|||||||
FILE *f_open(const Filename *fn, const char *mode, bool isprivate)
|
FILE *f_open(const Filename *fn, const char *mode, bool isprivate)
|
||||||
{
|
{
|
||||||
wchar_t *wmode = dup_mb_to_wc(DEFAULT_CODEPAGE, mode);
|
wchar_t *wmode = dup_mb_to_wc(DEFAULT_CODEPAGE, mode);
|
||||||
return _wfopen(fn->wpath, wmode);
|
FILE *fp = _wfopen(fn->wpath, wmode);
|
||||||
sfree(wmode);
|
sfree(wmode);
|
||||||
|
return fp;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user