Created
February 28, 2014 09:03
-
-
Save saghul/9267731 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc | |
index 4876422..4d6cdf3 100644 | |
--- a/src/spawn_sync.cc | |
+++ b/src/spawn_sync.cc | |
@@ -450,9 +450,10 @@ void SyncProcessRunner::TryInitializeAndRunLoop(Local<Value> options) { | |
assert(lifecycle_ == kUninitialized); | |
lifecycle_ = kInitialized; | |
- uv_loop_ = uv_loop_new(); | |
+ uv_loop_ = static_cast<uv_loop_t*>(malloc(sizeof *uv_loop_)); | |
if (uv_loop_ == NULL) | |
return SetError(UV_ENOMEM); | |
+ uv_loop_init(uv_loop_); | |
r = ParseOptions(options); | |
if (r < 0) | |
@@ -515,7 +516,9 @@ void SyncProcessRunner::CloseHandlesAndDeleteLoop() { | |
if (r < 0) | |
abort(); | |
- uv_loop_delete(uv_loop_); | |
+ assert(uv_loop_close(uv_loop_) == 0); | |
+ free(uv_loop_); | |
+ uv_loop_ = NULL; | |
} else { | |
// If the loop doesn't exist, neither should any pipes or timers. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment