Plug windows handle leak when open failed.

This commit is contained in:
enami tsugutomo 2016-10-24 12:35:20 +09:00
parent 23de171055
commit f25563dded

View file

@ -88,6 +88,7 @@ void EIO_Open(uv_work_t* req) {
if (!GetCommState(file, &dcb)) {
ErrorCodeToString("Open (GetCommState)", GetLastError(), data->errorString);
CloseHandle(file);
return;
}
@ -142,6 +143,7 @@ void EIO_Open(uv_work_t* req) {
if (!SetCommState(file, &dcb)) {
ErrorCodeToString("Open (SetCommState)", GetLastError(), data->errorString);
CloseHandle(file);
return;
}
@ -155,6 +157,7 @@ void EIO_Open(uv_work_t* req) {
if (!SetCommTimeouts(file, &commTimeouts)) {
ErrorCodeToString("Open (SetCommTimeouts)", GetLastError(), data->errorString);
CloseHandle(file);
return;
}