summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Nikias Bassen2023-02-21 11:05:40 +0100
committerGravatar Nikias Bassen2023-02-21 11:05:40 +0100
commitc797c2af6f4e2e8ae93b68f1c41abab1579563db (patch)
tree8a676b125867be34f2c417b8022afc23e4f8de62 /src
parent9a5e78fe56267d6c721c92055c3ae9702bd25871 (diff)
downloadlibimobiledevice-c797c2af6f4e2e8ae93b68f1c41abab1579563db.tar.gz
libimobiledevice-c797c2af6f4e2e8ae93b68f1c41abab1579563db.tar.bz2
reverse_proxy: Fix use-after-free
Diffstat (limited to 'src')
-rw-r--r--src/reverse_proxy.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/reverse_proxy.c b/src/reverse_proxy.c
index 3f0a839..3ab1031 100644
--- a/src/reverse_proxy.c
+++ b/src/reverse_proxy.c
@@ -186,10 +186,10 @@ static int _reverse_proxy_handle_proxy_cmd(reverse_proxy_client_t client)
186 186
187 /* else wait for messages and forward them */ 187 /* else wait for messages and forward them */
188 int sockfd = socket_connect(host, port); 188 int sockfd = socket_connect(host, port);
189 free(host);
190 if (sockfd < 0) { 189 if (sockfd < 0) {
191 free(buf); 190 free(buf);
192 _reverse_proxy_log(client, "ERROR: Connection to %s:%u failed: %s", host, port, strerror(errno)); 191 _reverse_proxy_log(client, "ERROR: Connection to %s:%u failed: %s", host, port, strerror(errno));
192 free(host);
193 return -1; 193 return -1;
194 } 194 }
195 195
@@ -259,6 +259,7 @@ static int _reverse_proxy_handle_proxy_cmd(reverse_proxy_client_t client)
259 } 259 }
260 } 260 }
261 socket_close(sockfd); 261 socket_close(sockfd);
262 free(host);
262 free(buf); 263 free(buf);
263 264
264 _reverse_proxy_status(client, RP_STATUS_DISCONNECTED, "Disconnected (out: %u / in: %u)", sent_total, recv_total); 265 _reverse_proxy_status(client, RP_STATUS_DISCONNECTED, "Disconnected (out: %u / in: %u)", sent_total, recv_total);