提交 6176df94 编写于 作者: R Richard Levitte

Make sure the opened directory is closed on exit.

Notified by Lorinczy Zsigmond <lzsiga@mail.ahiv.hu>
上级 a8f87882
...@@ -773,6 +773,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, ...@@ -773,6 +773,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
ret = 1; ret = 1;
err: err:
if (d) closedir(d);
CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
return ret; return ret;
} }
...@@ -798,7 +799,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, ...@@ -798,7 +799,7 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
SYSerr(SYS_F_OPENDIR, get_last_sys_error()); SYSerr(SYS_F_OPENDIR, get_last_sys_error());
ERR_add_error_data(3, "opendir('", dir, "')"); ERR_add_error_data(3, "opendir('", dir, "')");
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
goto err; goto err_noclose;
} }
do do
...@@ -819,10 +820,11 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, ...@@ -819,10 +820,11 @@ int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
goto err; goto err;
} }
while (FindNextFile(hFind, &FindFileData) != FALSE); while (FindNextFile(hFind, &FindFileData) != FALSE);
FindClose(hFind);
ret = 1; ret = 1;
err: err:
FindClose(hFind);
err_noclose:
CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册