Sven Baars : ntdll: Fix some memory leaks (Valgrind).
Alexandre Julliard
julliard at winehq.org
Mon May 3 16:37:05 CDT 2021
Module: wine
Branch: master
Commit: 2d218c924dec978f3ac41e5ab771d944f3c63491
URL: https://source.winehq.org/git/wine.git/?a=commit;h=2d218c924dec978f3ac41e5ab771d944f3c63491
Author: Sven Baars <sbaars at codeweavers.com>
Date: Sun May 2 16:36:19 2021 +0200
ntdll: Fix some memory leaks (Valgrind).
Signed-off-by: Sven Baars <sbaars at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ntdll/unix/env.c | 2 +-
dlls/ntdll/unix/file.c | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/unix/env.c b/dlls/ntdll/unix/env.c
index fc5c462e04f..3ac1ed9ab63 100644
--- a/dlls/ntdll/unix/env.c
+++ b/dlls/ntdll/unix/env.c
@@ -912,7 +912,7 @@ static void rebuild_argv(void)
*/
static void prepend_argv( const char **args, int count )
{
- char **new_argv = malloc( (main_argc + count) * sizeof(*new_argv) );
+ char **new_argv;
char *p, *end;
BOOL write_strings = FALSE;
int i, total = 0, new_argc = main_argc + count - 1;
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 2f18325fb90..c033bb06fa3 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3298,7 +3298,12 @@ static NTSTATUS nt_to_unix_file_name_no_root( const UNICODE_STRING *nameW, char
/* check if prefix exists (except for DOS drives to avoid extra stat calls) */
- if (wcschr( prefix, '/' )) return STATUS_OBJECT_PATH_NOT_FOUND;
+ if (wcschr( prefix, '/' ))
+ {
+ free( unix_name );
+ return STATUS_OBJECT_PATH_NOT_FOUND;
+ }
+
if (prefix_len != 2 || prefix[1] != ':')
{
unix_name[pos] = 0;
More information about the wine-cvs
mailing list