win,fs: avoid double freeing uv_fs_event_t.dirw

Set `dirw` to `pathw` after `uv_fs_event_start` is known to be completed
successfully.

Fixes: https://github.com/libuv/libuv/issues/1221
PR-URL: https://github.com/libuv/libuv/pull/1222
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
This commit is contained in:
Vladimir Matveev 2017-02-09 11:41:36 -08:00 committed by Santiago Gimeno
parent 309d603382
commit 02dcde0838
No known key found for this signature in database
GPG Key ID: F28C3C8DA33C03BE

View File

@ -188,7 +188,6 @@ int uv_fs_event_start(uv_fs_event_t* handle,
if (is_path_dir) {
/* path is a directory, so that's the directory that we will watch. */
handle->dirw = pathw;
dir_to_watch = pathw;
} else {
/*
@ -274,6 +273,8 @@ int uv_fs_event_start(uv_fs_event_t* handle,
goto error;
}
assert(is_path_dir ? pathw != NULL : pathw == NULL);
handle->dirw = pathw;
handle->req_pending = 1;
return 0;