aboutsummaryrefslogtreecommitdiff
path: root/libcacard
diff options
context:
space:
mode:
Diffstat (limited to 'libcacard')
-rw-r--r--libcacard/vscclient.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c
index 80111df00c..fa6041de99 100644
--- a/libcacard/vscclient.c
+++ b/libcacard/vscclient.c
@@ -597,7 +597,7 @@ connect_to_qemu(
const char *port
) {
struct addrinfo hints;
- struct addrinfo *server;
+ struct addrinfo *server = NULL;
int ret, sock;
sock = socket(AF_INET, SOCK_STREAM, 0);
@@ -629,9 +629,14 @@ connect_to_qemu(
if (verbose) {
printf("Connected (sizeof Header=%zd)!\n", sizeof(VSCMsgHeader));
}
+
+ freeaddrinfo(server);
return sock;
cleanup_socket:
+ if (server) {
+ freeaddrinfo(server);
+ }
closesocket(sock);
return -1;
}