Free allocated resource on error, CID 1358.

svn path=/trunk/; revision=37853
This commit is contained in:
Gregor Schneider 2008-12-04 16:46:54 +00:00
parent d27e3fc707
commit ea4870e585

View file

@ -1095,7 +1095,11 @@ FILE* CDECL _wfdopen(int fd, const wchar_t *mode)
if (modea &&
WideCharToMultiByte(CP_ACP,0,mode,mlen,modea,mlen,NULL,NULL))
{
if (get_flags(modea, &open_flags, &stream_flags) == -1) return NULL;
if (get_flags(modea, &open_flags, &stream_flags) == -1)
{
free(modea);
return NULL;
}
LOCK_FILES();
if (!(file = alloc_fp()))
file = NULL;