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

Unified Diff: chrome/browser/metrics/thread_watcher.cc

Issue 2295983002: Fix memory leak in ThreadWatcher. (Closed)
Patch Set: Created 4 years, 4 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/thread_watcher.cc
diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc
index 84a00ae4e45f32c74fe06ff11da31ca4f7e64500..6d1ecda6cb5519103f7d88022932866eb0182c7c 100644
--- a/chrome/browser/metrics/thread_watcher.cc
+++ b/chrome/browser/metrics/thread_watcher.cc
@@ -84,8 +84,10 @@ void ThreadWatcher::StartWatching(const WatchingParams& params) {
DCHECK(watcher);
// If we couldn't register the thread watcher object, we are shutting down,
// then don't activate thread watching.
- if (!ThreadWatcherList::IsRegistered(params.thread_id))
+ if (!ThreadWatcherList::IsRegistered(params.thread_id)) {
+ delete watcher;
Ilya Sherman 2016/08/30 23:51:57 Could you instead modify |watcher| to be a unique_
return;
+ }
watcher->ActivateThreadWatching();
alokp 2016/08/30 22:32:34 Is this leaked?
ramant (doing other things) 2016/08/30 22:45:12 watcher is stored in g_thread_watcher_list_. It is
alokp 2016/08/30 22:47:21 Thanks for the explanation. I think a comment abou
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698