From: koebi Date: Mon, 26 Sep 2016 15:01:30 +0000 (+0200) Subject: fix i3bar crashing when I3SOCK present (#2471) X-Git-Tag: 4.13~33 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=655ed0ba27b262fe6bd3d308df37f79e3c10d7c9;p=i3%2Fi3 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. --- diff --git a/i3bar/src/main.c b/i3bar/src/main.c index 3b5d7546..14e42a2b 100644 --- a/i3bar/src/main.c +++ b/i3bar/src/main.c @@ -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 */