Skip to content

Commit

Permalink
run_as_ipc_client: free response after running the IPC command
Browse files Browse the repository at this point in the history
Fixes memory leaks in the form of:

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x7f5f7c2f4f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30)
    swaywm#1 0x563c799569f2 in ipc_recv_response ../common/ipc-client.c:94
    swaywm#2 0x563c79957062 in ipc_single_command ../common/ipc-client.c:138
    swaywm#3 0x563c798a56cc in run_as_ipc_client ../sway/main.c:127
    swaywm#4 0x563c798a6a3a in main ../sway/main.c:349
    swaywm#5 0x7f5f7b4d609a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
  • Loading branch information
Emantor committed Feb 21, 2019
1 parent a968a65 commit aa4ccd8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sway/main.c
Expand Up @@ -126,6 +126,7 @@ void run_as_ipc_client(char *command, char *socket_path) {
uint32_t len = strlen(command);
char *resp = ipc_single_command(socketfd, IPC_COMMAND, command, &len);
printf("%s\n", resp);
free(resp);
close(socketfd);
}

Expand Down

0 comments on commit aa4ccd8

Please sign in to comment.