diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2017-09-18 17:38:59 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2017-09-22 01:18:51 +0300 |
commit | dce2738a91dec43ad50d31b390c81e04a78451cc (patch) | |
tree | b5467fe696a0c7670464c350ab4fbf1c2e3f9214 /src/node_perf.cc | |
parent | b210d61869edb0dbe0362db6a7226dada30ef94a (diff) |
src: handle uv_async_init() failure
Fix CHECKED_RETURN, RESOURCE_LEAK) and UNINIT Coverity warnings in
MarkGarbageCollectionEnd().
PR-URL: https://github.com/nodejs/node/pull/15458
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_perf.cc')
-rw-r--r-- | src/node_perf.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/node_perf.cc b/src/node_perf.cc index 95e93259f47..f5aafbab63a 100644 --- a/src/node_perf.cc +++ b/src/node_perf.cc @@ -212,13 +212,14 @@ void MarkGarbageCollectionEnd(Isolate* isolate, v8::GCCallbackFlags flags, void* data) { Environment* env = static_cast<Environment*>(data); - uv_async_t *async = new uv_async_t; + uv_async_t* async = new uv_async_t(); // coverity[leaked_storage] + if (uv_async_init(env->event_loop(), async, PerformanceGCCallback)) + return delete async; async->data = new PerformanceEntry::Data(env, "gc", "gc", performance_last_gc_start_mark_, PERFORMANCE_NOW(), type); - uv_async_init(env->event_loop(), async, PerformanceGCCallback); - uv_async_send(async); + CHECK_EQ(0, uv_async_send(async)); } inline void SetupGarbageCollectionTracking(Environment* env) { |