Skip to content

Commit

Permalink
[OpenVINO]Fix memory leak in IsDebugEnabled() under Windows (micros…
Browse files Browse the repository at this point in the history
…oft#5948)

* w

* w

Co-authored-by: modav <modav@microsoft.com>
  • Loading branch information
mosdav and modav authored Nov 26, 2020
1 parent 4afdced commit e207589
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion onnxruntime/core/providers/openvino/backend_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ bool IsDebugEnabled() {
#ifdef _WIN32
size_t env_name_len = 0;
char* env_name = nullptr;
return (_dupenv_s(&env_name, &env_name_len, "ORT_OPENVINO_ENABLE_DEBUG") == 0 && env_name != nullptr);
bool res = (_dupenv_s(&env_name, &env_name_len, "ORT_OPENVINO_ENABLE_DEBUG") == 0 && env_name != nullptr);
free(env_name);
return res;
#else
return (std::getenv("ORT_OPENVINO_ENABLE_DEBUG") != nullptr);
#endif
Expand Down

0 comments on commit e207589

Please sign in to comment.