Merge pull request #3827 from orestisfl/i3bar-leak
Fix small leak in i3bar's main
This commit is contained in:
commit
3127a94c0d
|
@ -92,13 +92,7 @@ static void sig_cb(struct ev_loop *loop, ev_signal *watcher, int revents) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
int opt;
|
char *socket_path = NULL;
|
||||||
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 */
|
/* Initialize the standard config to use 0 as default */
|
||||||
memset(&config, '\0', sizeof(config_t));
|
memset(&config, '\0', sizeof(config_t));
|
||||||
|
@ -112,6 +106,8 @@ int main(int argc, char **argv) {
|
||||||
{"verbose", no_argument, 0, 'V'},
|
{"verbose", no_argument, 0, 'V'},
|
||||||
{NULL, 0, 0, 0}};
|
{NULL, 0, 0, 0}};
|
||||||
|
|
||||||
|
int opt;
|
||||||
|
int option_index = 0;
|
||||||
while ((opt = getopt_long(argc, argv, "b:s:thvV", long_opt, &option_index)) != -1) {
|
while ((opt = getopt_long(argc, argv, "b:s:thvV", long_opt, &option_index)) != -1) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 's':
|
case 's':
|
||||||
|
@ -144,10 +140,17 @@ int main(int argc, char **argv) {
|
||||||
exit(EXIT_FAILURE);
|
exit(EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
|
|
||||||
main_loop = ev_default_loop(0);
|
main_loop = ev_default_loop(0); /* needed in init_xcb_early */
|
||||||
|
|
||||||
char *atom_sock_path = init_xcb_early();
|
char *atom_sock_path = init_xcb_early();
|
||||||
|
|
||||||
|
/* Select a socket_path if the user hasn't specified one */
|
||||||
|
if (socket_path == NULL) {
|
||||||
|
socket_path = getenv("I3SOCK");
|
||||||
|
if (socket_path != NULL) {
|
||||||
|
socket_path = sstrdup(socket_path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (socket_path == NULL) {
|
if (socket_path == NULL) {
|
||||||
socket_path = atom_sock_path;
|
socket_path = atom_sock_path;
|
||||||
} else {
|
} else {
|
||||||
|
@ -155,8 +158,9 @@ int main(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (socket_path == NULL) {
|
if (socket_path == NULL) {
|
||||||
|
char *i3_default_sock_path = "/tmp/i3-ipc.sock";
|
||||||
ELOG("No socket path specified, default to %s\n", i3_default_sock_path);
|
ELOG("No socket path specified, default to %s\n", i3_default_sock_path);
|
||||||
socket_path = expand_path(i3_default_sock_path);
|
socket_path = sstrdup(i3_default_sock_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
init_dpi();
|
init_dpi();
|
||||||
|
|
Loading…
Reference in New Issue