Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

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 David Salinas committed Oct 13, 2023
1 parent e13ccf3 commit 33d21c5
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 33d21c5

Please sign in to comment.