diff options
author | Zachary Snow <zach@zachjs.com> | 2021-06-14 11:59:01 -0400 |
---|---|---|
committer | Zachary Snow <zachary.j.snow@gmail.com> | 2021-06-14 12:33:26 -0400 |
commit | b516c681fe6c06fb089fe1e1bc081ffeb56c7949 (patch) | |
tree | 9d16acad76ab9f942a4513ade6cd3f3fae335b7c /kernel | |
parent | 081111714eed9cbc3dacac766cad85de30e98073 (diff) | |
download | yosys-b516c681fe6c06fb089fe1e1bc081ffeb56c7949.tar.gz yosys-b516c681fe6c06fb089fe1e1bc081ffeb56c7949.tar.bz2 yosys-b516c681fe6c06fb089fe1e1bc081ffeb56c7949.zip |
macos: fix leak in proc_self_dirname()
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/yosys.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/yosys.cc b/kernel/yosys.cc index efc429529..cb6fdc2f4 100644 --- a/kernel/yosys.cc +++ b/kernel/yosys.cc @@ -797,7 +797,9 @@ std::string proc_self_dirname() path = (char *) realloc((void *) path, buflen); while (buflen > 0 && path[buflen-1] != '/') buflen--; - return std::string(path, buflen); + std::string str(path, buflen); + free(path); + return str; } #elif defined(_WIN32) std::string proc_self_dirname() |