fix i3bar crashing when I3SOCK present (#2471)

When I3SOCK is present, socket_path might be a pointer to an
environment variable, which cannot be free'd in line 157. This
commit duplicates the string if I3SOCK is present, thus making
socket_path a free-able pointer again.
next
koebi 2016-09-26 17:01:30 +02:00 committed by Michael Stapelberg
parent 23ee16077a
commit 655ed0ba27
1 changed files with 3 additions and 0 deletions

View File

@ -93,6 +93,9 @@ int main(int argc, char **argv) {
int opt;
int option_index = 0;
char *socket_path = getenv("I3SOCK");
if (socket_path != NULL) {
socket_path = sstrdup(socket_path);
}
char *i3_default_sock_path = "/tmp/i3-ipc.sock";
/* Initialize the standard config to use 0 as default */