Skip to content

Commit

Permalink
src: handle uv_async_init() failure
Browse files Browse the repository at this point in the history
Fix CHECKED_RETURN, RESOURCE_LEAK) and UNINIT Coverity warnings in
MarkGarbageCollectionEnd().

PR-URL: nodejs/node#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>
  • Loading branch information
bnoordhuis authored and addaleax committed Sep 23, 2017
1 parent 2292381 commit 03c686b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/node_perf.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 03c686b

Please sign in to comment.