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

Unified Diff: third_party/tcmalloc/chromium/src/free_list.h

Issue 8000001: Catch some "easy to spot" double frees in TCMalloc (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | « no previous file | third_party/tcmalloc/chromium/src/free_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tcmalloc/chromium/src/free_list.h
===================================================================
--- third_party/tcmalloc/chromium/src/free_list.h (revision 103832)
+++ third_party/tcmalloc/chromium/src/free_list.h (working copy)
@@ -40,6 +40,7 @@
#define TCMALLOC_FREE_LIST_H_
#include <stddef.h>
+#include "internal_logging.h" // For CRASH() macro.
#include "linked_list.h"
namespace tcmalloc {
@@ -69,7 +70,11 @@
}
inline void FL_Push(void **list, void *element) {
- SLL_Push(list,element);
+ if(*list != element) {
+ SLL_Push(list,element);
+ return;
+ }
+ CRASH("Double Free of %p detected", element);
}
inline void *FL_Pop(void **list) {
« no previous file with comments | « no previous file | third_party/tcmalloc/chromium/src/free_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698