Skip to content

Commit e207589

Browse files
mosdavmodav
andauthored
[OpenVINO]Fix memory leak in IsDebugEnabled() under Windows (#5948)
* w * w Co-authored-by: modav <modav@microsoft.com>
1 parent 4afdced commit e207589

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

onnxruntime/core/providers/openvino/backend_utils.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ bool IsDebugEnabled() {
2626
#ifdef _WIN32
2727
size_t env_name_len = 0;
2828
char* env_name = nullptr;
29-
return (_dupenv_s(&env_name, &env_name_len, "ORT_OPENVINO_ENABLE_DEBUG") == 0 && env_name != nullptr);
29+
bool res = (_dupenv_s(&env_name, &env_name_len, "ORT_OPENVINO_ENABLE_DEBUG") == 0 && env_name != nullptr);
30+
free(env_name);
31+
return res;
3032
#else
3133
return (std::getenv("ORT_OPENVINO_ENABLE_DEBUG") != nullptr);
3234
#endif

0 commit comments

Comments
 (0)