Browse Source

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>
canary-base
Ben Noordhuis 7 years ago
committed by Ruben Bridgewater
parent
commit
dce2738a91
No known key found for this signature in database GPG Key ID: F07496B3EB3C1762
  1. 7
      src/node_perf.cc

7
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) {

Loading…
Cancel
Save