Don't check pointers for NULL before RtlFreeHeap. It is redundant.
Michael Stefaniuc
mstefani at redhat.de
Mon May 1 15:44:43 CDT 2006
Hello!
Looks like i forgot in the last round to check RtlFreeHeap too for
redundant NULL pointer checks. This patch applies cleanly both to origin
and mmbranch.
A couple of NULL pointer checks have accumulated since last years round
for HeapFree. But i'll send a patch for those when Alexandre is back and
after he walked through the backlog of patches. mmbranch adds/removes
NULL checks in comparision to origin.
bye
michael
---
dlls/kernel/sync.c | 7 ++-----
dlls/ntdll/debugbuffer.c | 6 +++---
dlls/ntdll/reg.c | 3 +--
dlls/ntdll/thread.c | 2 +-
4 files changed, 7 insertions(+), 11 deletions(-)
42c407c0079bc61208691de52ee6d56fe4bb9d3a
diff --git a/dlls/kernel/sync.c b/dlls/kernel/sync.c
index cec44f5..8c43e53 100644
--- a/dlls/kernel/sync.c
+++ b/dlls/kernel/sync.c
@@ -386,11 +386,8 @@ void WINAPI MakeCriticalSectionGlobal( C
HANDLE sem = crit->LockSemaphore;
if (!sem) NtCreateSemaphore( &sem, SEMAPHORE_ALL_ACCESS, NULL, 0, 1 );
crit->LockSemaphore = ConvertToGlobalHandle( sem );
- if (crit->DebugInfo)
- {
- RtlFreeHeap( GetProcessHeap(), 0, crit->DebugInfo );
- crit->DebugInfo = NULL;
- }
+ RtlFreeHeap( GetProcessHeap(), 0, crit->DebugInfo );
+ crit->DebugInfo = NULL;
}
diff --git a/dlls/ntdll/debugbuffer.c b/dlls/ntdll/debugbuffer.c
index 600c7fa..424b112 100644
--- a/dlls/ntdll/debugbuffer.c
+++ b/dlls/ntdll/debugbuffer.c
@@ -107,9 +107,9 @@ NTSTATUS WINAPI RtlDestroyQueryDebugBuff
NTSTATUS nts = STATUS_SUCCESS;
FIXME("(%p): stub\n", iBuf);
if (NULL != iBuf) {
- if (NULL != iBuf->ModuleInformation) RtlFreeHeap(GetProcessHeap(), 0, iBuf->ModuleInformation);
- if (NULL != iBuf->HeapInformation) RtlFreeHeap(GetProcessHeap(), 0, iBuf->HeapInformation);
- if (NULL != iBuf->LockInformation) RtlFreeHeap(GetProcessHeap(), 0, iBuf->LockInformation);
+ RtlFreeHeap(GetProcessHeap(), 0, iBuf->ModuleInformation);
+ RtlFreeHeap(GetProcessHeap(), 0, iBuf->HeapInformation);
+ RtlFreeHeap(GetProcessHeap(), 0, iBuf->LockInformation);
RtlFreeHeap(GetProcessHeap(), 0, iBuf);
}
return nts;
diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c
index aa5a6ab..e3266c5 100644
--- a/dlls/ntdll/reg.c
+++ b/dlls/ntdll/reg.c
@@ -345,8 +345,7 @@ NTSTATUS WINAPI RtlpNtEnumerateSubKey( H
}
}
- if (info)
- RtlFreeHeap( GetProcessHeap(), 0, info );
+ RtlFreeHeap( GetProcessHeap(), 0, info );
return ret;
}
diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c
index 67e6930..efe2a46 100644
--- a/dlls/ntdll/thread.c
+++ b/dlls/ntdll/thread.c
@@ -470,7 +470,7 @@ error:
SIZE_T size = 0;
NtFreeVirtualMemory( NtCurrentProcess(), &addr, &size, MEM_RELEASE );
}
- if (info) RtlFreeHeap( GetProcessHeap(), 0, info );
+ RtlFreeHeap( GetProcessHeap(), 0, info );
if (handle) NtClose( handle );
close( request_pipe[1] );
return status;
--
1.3.1
--
Michael Stefaniuc Tel.: +49-711-96437-199
Sr. Network Engineer Fax.: +49-711-96437-111
Red Hat GmbH Email: mstefani at redhat.com
Hauptstaetterstr. 58 http://www.redhat.de/
D-70178 Stuttgart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20060501/a4730b67/attachment.pgp
More information about the wine-patches
mailing list