minicom/memleaks_term_socket_connect_tcp.patch

31 lines
712 B
Diff
Raw Normal View History

diff --git a/src/main.c b/src/main.c
index f5f65e1..8767032 100644
--- a/src/main.c
+++ b/src/main.c
@@ -190,6 +190,7 @@ static void term_socket_connect_tcp(void)
char *s_port = strchr(s_addr, ':');
if (!s_port) {
fprintf(stderr, "No port given\n");
+ free(s);
return;
}
*s_port = 0;
@@ -202,6 +203,7 @@ static void term_socket_connect_tcp(void)
int r = getaddrinfo(s_addr, s_port, &hints, &result);
if (r) {
fprintf(stderr, "Name resolution failed: %s\n", gai_strerror(r));
+ free(s);
return;
}
@@ -221,8 +223,7 @@ static void term_socket_connect_tcp(void)
term_socket_close();
}
- if (rp)
- freeaddrinfo(result);
+ freeaddrinfo(result);
}
/*