Commit ef01f6ac authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Use malloc() to allocate the buffer in unix_to_nt_file_name().

parent 314cd9cd
......@@ -1064,7 +1064,7 @@ static void add_path_var( WCHAR *env, SIZE_T *pos, const char *name, const char
{
if (unix_to_nt_file_name( path, &nt_name )) return;
append_envW( env, pos, name, nt_name );
RtlFreeHeap( GetProcessHeap(), 0, nt_name );
free( nt_name );
}
}
......@@ -1217,7 +1217,7 @@ void CDECL get_initial_directory( UNICODE_STRING *dir )
memcpy( dir->Buffer, nt_name, dir->Length );
dir->Buffer[1] = '\\';
}
RtlFreeHeap( GetProcessHeap(), 0, nt_name );
free( nt_name );
}
}
......
......@@ -1834,7 +1834,7 @@ static NTSTATUS fill_name_info( const char *unix_name, FILE_NAME_INFORMATION *in
else *name_len = info->FileNameLength;
memcpy( info->FileName, ptr, *name_len );
RtlFreeHeap( GetProcessHeap(), 0, nt_name );
free( nt_name );
}
return status;
......@@ -3447,8 +3447,7 @@ NTSTATUS unix_to_nt_file_name( const char *name, WCHAR **nt )
else if (status != STATUS_OBJECT_PATH_NOT_FOUND) return status;
lenW = wcslen( prefix );
if (!(buffer = RtlAllocateHeap( GetProcessHeap(), 0, (lenA + lenW + 1) * sizeof(WCHAR) )))
return STATUS_NO_MEMORY;
if (!(buffer = malloc( (lenA + lenW + 1) * sizeof(WCHAR) ))) return STATUS_NO_MEMORY;
memcpy( buffer, prefix, lenW * sizeof(WCHAR) );
lenW += ntdll_umbstowcs( path, lenA, buffer + lenW, lenA );
buffer[lenW] = 0;
......@@ -3474,7 +3473,7 @@ NTSTATUS CDECL wine_unix_to_nt_file_name( const char *name, WCHAR *buffer, SIZE_
if (*size > wcslen(nt_name)) wcscpy( buffer, nt_name );
else status = STATUS_BUFFER_TOO_SMALL;
*size = wcslen(nt_name) + 1;
RtlFreeHeap( GetProcessHeap(), 0, nt_name );
free( nt_name );
}
return status;
}
......@@ -6411,7 +6410,7 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
wcscpy( p->Name.Buffer, nt_name );
}
if (used_len) *used_len = sizeof(*p) + size;
RtlFreeHeap( GetProcessHeap(), 0, nt_name );
free( nt_name );
}
RtlFreeHeap( GetProcessHeap(), 0, unix_name );
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment