aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSanttu Lakkala <santtu.lakkala@unikie.com>2025-02-04 13:09:49 +0200
committerSanttu Lakkala <santtu.lakkala@unikie.com>2025-02-04 13:11:56 +0200
commit11d1adca7a2f3e398722f3160ac6a8061f18c31d (patch)
treecf4deaf5e76e399ad86a940d48872f90bed6cb56
parenta3d4575d91680580c69855c6732c6fe8a4db5fef (diff)
Fix memory leaks
Fix a memory leak on each login; the allocated OpenSSL BIOs were only freed partially. Also add a missing deallocation during server socket creation.
-rw-r--r--xs_openssl.h2
-rw-r--r--xs_socket.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/xs_openssl.h b/xs_openssl.h
index 9388691..f215bcc 100644
--- a/xs_openssl.h
+++ b/xs_openssl.h
@@ -83,7 +83,7 @@ xs_val *xs_base64_dec(const xs_str *data, int *size)
s = xs_realloc(s, _xs_blk_size(*size + 1));
s[*size] = '\0';
- BIO_free_all(mem);
+ BIO_free_all(b64);
return s;
}
diff --git a/xs_socket.h b/xs_socket.h
index 6e618ba..7bf5298 100644
--- a/xs_socket.h
+++ b/xs_socket.h
@@ -85,6 +85,8 @@ int xs_socket_server(const char *addr, const char *serv)
listen(rs, SOMAXCONN);
}
+ freeaddrinfo(res);
+
#else /* WITHOUT_GETADDRINFO */
struct sockaddr_in host;