Commit 2b1ebef
authored
Fixed small memory leak in libprofile (llvm#141739)
Inside `getCurFilename`, there is this code snippit
```
if (!lprofCurFilename.FilenamePat || !lprofCurFilename.FilenamePat[0])
return 0;
```
If this is true, we return `"\0"`, but would leak the memory in
`FilenameBuf`.
This pull request adds a free before then to properly free the memory.
There was already a check that we allocated memory, so there is no need
to worry about freeing unallocated memory.1 parent 0ebe555 commit 2b1ebef
1 file changed
+3
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1088 | 1088 | | |
1089 | 1089 | | |
1090 | 1090 | | |
1091 | | - | |
| 1091 | + | |
| 1092 | + | |
1092 | 1093 | | |
| 1094 | + | |
1093 | 1095 | | |
1094 | 1096 | | |
1095 | 1097 | | |
| |||
0 commit comments