Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: handle uv_async_init() failure #15458

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ inline const struct read_result read_file(uv_file file) {
struct file_check {
bool failed = true;
uv_file file = -1;
} file_check;
};
inline const struct file_check check_file(URL search,
bool close = false,
bool allow_dir = false) {
Expand Down
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
28 changes: 14 additions & 14 deletions src/node_perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ class PerformanceEntry : public BaseObject {
return env_;
}

std::string name() const {
const std::string& name() const {
return name_;
}

std::string type() const {
const std::string& type() const {
return type_;
}

Expand All @@ -94,12 +94,12 @@ class PerformanceEntry : public BaseObject {
}

private:
Environment* env_;
std::string name_;
std::string type_;
uint64_t startTime_;
uint64_t endTime_;
int data_;
Environment* const env_;
const std::string name_;
const std::string type_;
const uint64_t startTime_;
const uint64_t endTime_;
const int data_;
};

static void NotifyObservers(Environment* env, PerformanceEntry* entry);
Expand Down Expand Up @@ -135,11 +135,11 @@ class PerformanceEntry : public BaseObject {

~PerformanceEntry() {}

std::string name() const {
const std::string& name() const {
return name_;
}

std::string type() const {
const std::string& type() const {
return type_;
}

Expand All @@ -160,10 +160,10 @@ class PerformanceEntry : public BaseObject {
}

private:
std::string name_;
std::string type_;
uint64_t startTime_;
uint64_t endTime_;
const std::string name_;
const std::string type_;
const uint64_t startTime_;
const uint64_t endTime_;
};

enum PerformanceGCKind {
Expand Down