Merge pull request #4088 from stapelberg/san
free(socket_path) to suppress leak sanitizer false-positive with -O2
This commit is contained in:
commit
7a4354f42a
@ -380,6 +380,11 @@ int main(int argc, char *argv[]) {
|
||||
char *socket_path = root_atom_contents("I3_SOCKET_PATH", NULL, 0);
|
||||
if (socket_path) {
|
||||
printf("%s\n", socket_path);
|
||||
/* With -O2 (i.e. the buildtype=debugoptimized meson
|
||||
* option, which we set by default), gcc 9.2.1 optimizes
|
||||
* away socket_path at this point, resulting in a Leak
|
||||
* Sanitizer report. An explicit free helps: */
|
||||
free(socket_path);
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user