aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Rouven Czerwinski <rouven@czerwinskis.de>2019-02-21 08:37:23 +0100
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-02-25 17:10:04 -0500
commit099d25e975e811259e4e1709925f6ae3a7be4367 (patch)
tree1f062c4148f79cd4dabaa58f97dfdd27f0923d3d
parentipc-client: free payload after sending it over the socket (diff)
downloadsway-099d25e975e811259e4e1709925f6ae3a7be4367.tar.gz
sway-099d25e975e811259e4e1709925f6ae3a7be4367.tar.zst
sway-099d25e975e811259e4e1709925f6ae3a7be4367.zip
run_as_ipc_client: free response after running the IPC command
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) #1 0x563c799569f2 in ipc_recv_response ../common/ipc-client.c:94 #2 0x563c79957062 in ipc_single_command ../common/ipc-client.c:138 #3 0x563c798a56cc in run_as_ipc_client ../sway/main.c:127 #4 0x563c798a6a3a in main ../sway/main.c:349 #5 0x7f5f7b4d609a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)
-rw-r--r--sway/main.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sway/main.c b/sway/main.c
index 5a65e50c..6754190f 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -126,6 +126,7 @@ void run_as_ipc_client(char *command, char *socket_path) {
126 uint32_t len = strlen(command); 126 uint32_t len = strlen(command);
127 char *resp = ipc_single_command(socketfd, IPC_COMMAND, command, &len); 127 char *resp = ipc_single_command(socketfd, IPC_COMMAND, command, &len);
128 printf("%s\n", resp); 128 printf("%s\n", resp);
129 free(resp);
129 close(socketfd); 130 close(socketfd);
130} 131}
131 132