2009/2/17 Andrew Talbot <andrew.tal...@talbotville.com>: > Changelog: > ntdll: Replace malloc() with RtlAllocateHeap(). > > diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c > index 145540f..0cade3f 100644 > --- a/dlls/ntdll/server.c > +++ b/dlls/ntdll/server.c > @@ -743,13 +743,13 @@ static void setup_config_dir(void) > struct stat st; > char *tmp_dir; > > - if (!(tmp_dir = malloc( p + 1 - config_dir ))) fatal_error( "out > of memory\n" ); > + if (!(tmp_dir = RtlAllocateHeap( GetProcessHeap(), 0, p + 1 - > config_dir ))) fatal_error( "out of memory\n" ); > memcpy( tmp_dir, config_dir, p - config_dir ); > tmp_dir[p - config_dir] = 0; > if (!stat( tmp_dir, &st ) && st.st_uid != getuid()) > fatal_error( "'%s' is not owned by you, refusing to create a > configuration directory there\n", > tmp_dir ); > - free( tmp_dir ); > + RtlFreeHeap( GetProcessHeap(), 0, tmp_dir ); > }
I'd be surprised if this worked, since setup_config_dir is called very early in the ntdll execution sequence, and RtlAllocateHeap itself will depend on server calls (NtAllocateVirtualMemory, NtCreateMutex, etc.) that depend on the server having started (i.e. after this function having already executed). -- Rob Shearman