From 655ed0ba27b262fe6bd3d308df37f79e3c10d7c9 Mon Sep 17 00:00:00 2001 From: koebi Date: Mon, 26 Sep 2016 17:01:30 +0200 Subject: [PATCH] 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. --- i3bar/src/main.c | 3 +++ 1 file changed, 3 insertions(+) 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 */ -- 2.39.5