"Peter Beutner" p.beutner@gmx.net wrote:
Probably an exception handler should be added inside of RtlFreeHeap instead.
hm, i vaguely remember reading here that it was prefered not to cover up crashes produced by passing invalid pointers, unless absolutely necessary.
If the crash is caused by a NULL pointer then the fix is easy and doesn't require using an exception handler, but it's not possible in this case.
And here we can fix that nicely in some other way. See attached patch. Would that be acceptable as well?
diff --git a/dlls/kernel32/environ.c b/dlls/kernel32/environ.c index 414ccbf..f7890cc 100644 --- a/dlls/kernel32/environ.c +++ b/dlls/kernel32/environ.c @@ -148,6 +148,10 @@ LPWSTR WINAPI GetEnvironmentStringsW(void) */ BOOL WINAPI FreeEnvironmentStringsA( LPSTR ptr ) {
- /* broken app passes ptr it got from GetEnvironmentStringsW */
- if(ptr == NtCurrentTeb()->Peb->ProcessParameters->Environment)
return TRUE;
- return HeapFree( GetProcessHeap(), 0, ptr );
}
Personally I think that adding an exception handler or probably just a more strict consistency check inside of RtlFreeHeap should be better.