i3bar: fix memory leak in socket path

This commit is contained in:
Michael Stapelberg 2016-01-09 12:30:15 +01:00
parent 9eba061ed3
commit 9dde0b9b18
1 changed files with 3 additions and 0 deletions

View File

@ -137,6 +137,8 @@ int main(int argc, char **argv) {
if (socket_path == NULL) { if (socket_path == NULL) {
socket_path = atom_sock_path; socket_path = atom_sock_path;
} else {
free(atom_sock_path);
} }
if (socket_path == NULL) { if (socket_path == NULL) {
@ -149,6 +151,7 @@ int main(int argc, char **argv) {
/* Request the bar configuration. When it arrives, we fill the config array. */ /* Request the bar configuration. When it arrives, we fill the config array. */
i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_BAR_CONFIG, config.bar_id); i3_send_msg(I3_IPC_MESSAGE_TYPE_GET_BAR_CONFIG, config.bar_id);
} }
free(socket_path);
/* We listen to SIGTERM/QUIT/INT and try to exit cleanly, by stopping the main loop. /* We listen to SIGTERM/QUIT/INT and try to exit cleanly, by stopping the main loop.
* We only need those watchers on the stack, so putting them on the stack saves us * We only need those watchers on the stack, so putting them on the stack saves us