Skip to content

Commit 8cc1a8d

Browse files
committed
fix: fix a leak in cpp_util
1 parent 0d18aec commit 8cc1a8d

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

compiler/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ ADD scripts /app/scripts
3333
ADD libs /app/libs
3434
ADD runtime /app/runtime
3535
ADD carpntr /app/carpntr
36+
ADD test_libs /app/test_libs
3637
ADD bin/test.txt /app/test.txt
3738
RUN mkdir "/app/bin"
3839

compiler/src/utilities/cpp_util.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ std::string yaksha::get_my_exe_path() {
5858
if (path == nullptr) { return ""; }
5959
wai_getModulePath(path, length, nullptr);
6060
path[length] = '\0';
61-
return std::string{path,
62-
static_cast<std::basic_string<char>::size_type>(length)};
61+
auto exe_path = std::string{
62+
path, static_cast<std::basic_string<char>::size_type>(length)};
63+
free(path);
64+
return exe_path;
6365
}
6466
#endif

0 commit comments

Comments
 (0)