Skip to content

Commit

Permalink
[Comgr] Fix issue in which Path memory freed before return
Browse files Browse the repository at this point in the history
Previously we freed "Line" before returning. However the StringRef
Path, which was built from the StringRef vector Tokens, depends on
Line, instead of making a copy.

Change-Id: I4861e0cca5c59458f731a7ecb523ac009d285bb0
  • Loading branch information
lamb-j authored and Mystro256 committed Dec 12, 2023
1 parent f4a1ec7 commit 4510c28
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/comgr/src/comgr-env.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,10 @@ std::string getComgrInstallPathFromExecutable() {
return "";
}

std::string rv = StripGNUInstallLibDir(Path).str();
fclose(ProcMaps);
free(Line);
return StripGNUInstallLibDir(Path).str();
return rv;
}
}

Expand Down

0 comments on commit 4510c28

Please sign in to comment.