From ea4870e585ea8247311d7eb63c46925ecb5ebf1f Mon Sep 17 00:00:00 2001 From: Gregor Schneider Date: Thu, 4 Dec 2008 16:46:54 +0000 Subject: [PATCH] Free allocated resource on error, CID 1358. svn path=/trunk/; revision=37853 --- reactos/lib/sdk/crt/stdio/file.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/reactos/lib/sdk/crt/stdio/file.c b/reactos/lib/sdk/crt/stdio/file.c index 72754707685..aa986f0048b 100644 --- a/reactos/lib/sdk/crt/stdio/file.c +++ b/reactos/lib/sdk/crt/stdio/file.c @@ -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;