Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1790)

Unified Diff: base/allocator/winheap_stubs_win.cc

Issue 2377633002: corrected undefined behaviour when ptr is NULL in HeapFree (Closed)
Patch Set: added myself to authors file Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/winheap_stubs_win.cc
diff --git a/base/allocator/winheap_stubs_win.cc b/base/allocator/winheap_stubs_win.cc
index 7298bb9411ad3601df13ce512b6f20281f4756a9..593e386ed9e741c97168d47bff391fdad44d7993 100644
--- a/base/allocator/winheap_stubs_win.cc
+++ b/base/allocator/winheap_stubs_win.cc
@@ -35,8 +35,11 @@ void* WinHeapMalloc(size_t size) {
return nullptr;
}
-void WinHeapFree(void* size) {
- HeapFree(get_heap_handle(), 0, size);
+void WinHeapFree(void* ptr) {
+ if (!ptr)
+ return;
+
+ HeapFree(get_heap_handle(), 0, ptr);
}
void* WinHeapRealloc(void* ptr, size_t size) {
« no previous file with comments | « AUTHORS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698