summaryrefslogtreecommitdiff
path: root/src/udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/udp.c')
-rw-r--r--src/udp.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/udp.c b/src/udp.c
index 2ffeab6..ca83561 100644
--- a/src/udp.c
+++ b/src/udp.c
@@ -81,6 +81,7 @@ void udp_init(udp_socket_t** sock, const char* local_addr, const char* port)
(*sock)->fd_ = socket(res->ai_family, SOCK_DGRAM, 0);
if((*sock)->fd_ < 0) {
log_printf(ERR, "Error on opening udp socket: %m");
+ freeaddrinfo(res);
free(*sock);
*sock = NULL;
return;
@@ -89,6 +90,7 @@ void udp_init(udp_socket_t** sock, const char* local_addr, const char* port)
errcode = bind((*sock)->fd_, res->ai_addr, res->ai_addrlen);
if(errcode) {
log_printf(ERR, "Error on binding udp socket: %m");
+ freeaddrinfo(res);
free(*sock);
*sock = NULL;
return;