[PATCH] ntdll: Fix memory leak on error path in NtCreateFile (scan-build)

Alex Henrie alexhenrie24 at gmail.com
Mon Dec 20 23:02:48 CST 2021


Signed-off-by: Alex Henrie <alexhenrie24 at gmail.com>
---
 dlls/ntdll/unix/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 07bfa6c22c4..a3437099872 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -3785,9 +3785,9 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
     {
         status = open_unix_file( handle, unix_name, access, &new_attr, attributes,
                                  sharing, disposition, options, ea_buffer, ea_length );
-        free( unix_name );
     }
     else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status );
+    free( unix_name );
 
     if (status == STATUS_SUCCESS)
     {
-- 
2.34.1




More information about the wine-devel mailing list