mirror of
https://github.com/outbackdingo/parodus.git
synced 2026-01-27 10:20:04 +00:00
68 lines
1.9 KiB
Diff
68 lines
1.9 KiB
Diff
diff --git a/src/transports/tcp/btcp.c b/src/transports/tcp/btcp.c
|
|
index 37541f1..4fe8b58 100644
|
|
--- a/src/transports/tcp/btcp.c
|
|
+++ b/src/transports/tcp/btcp.c
|
|
@@ -118,11 +118,13 @@ int nn_btcp_create (struct nn_ep *ep)
|
|
end = addr + strlen (addr);
|
|
pos = strrchr (addr, ':');
|
|
if (pos == NULL) {
|
|
+ nn_free (self);
|
|
return -EINVAL;
|
|
}
|
|
++pos;
|
|
rc = nn_port_resolve (pos, end - pos);
|
|
if (rc < 0) {
|
|
+ nn_free (self);
|
|
return -EINVAL;
|
|
}
|
|
|
|
@@ -134,6 +136,7 @@ int nn_btcp_create (struct nn_ep *ep)
|
|
/* Parse the address. */
|
|
rc = nn_iface_resolve (addr, pos - addr - 1, ipv4only, &ss, &sslen);
|
|
if (nn_slow (rc < 0)) {
|
|
+ nn_free (self);
|
|
return -ENODEV;
|
|
}
|
|
|
|
@@ -151,6 +154,7 @@ int nn_btcp_create (struct nn_ep *ep)
|
|
|
|
rc = nn_btcp_listen (self);
|
|
if (rc != 0) {
|
|
+ // I suspect we might need to do nn_free here.
|
|
return rc;
|
|
}
|
|
|
|
diff --git a/src/transports/tcp/ctcp.c b/src/transports/tcp/ctcp.c
|
|
index 8486f2b..fc9bc90 100644
|
|
--- a/src/transports/tcp/ctcp.c
|
|
+++ b/src/transports/tcp/ctcp.c
|
|
@@ -150,10 +150,12 @@ int nn_ctcp_create (struct nn_ep *ep)
|
|
|
|
/* Parse the port. */
|
|
if (!colon) {
|
|
+ nn_free (self);
|
|
return -EINVAL;
|
|
}
|
|
rc = nn_port_resolve (colon + 1, end - colon - 1);
|
|
if (rc < 0) {
|
|
+ nn_free (self);
|
|
return -EINVAL;
|
|
}
|
|
|
|
@@ -162,6 +164,7 @@ int nn_ctcp_create (struct nn_ep *ep)
|
|
if (nn_dns_check_hostname (hostname, colon - hostname) < 0 &&
|
|
nn_literal_resolve (hostname, colon - hostname, ipv4only,
|
|
&ss, &sslen) < 0) {
|
|
+ nn_free (self);
|
|
return -EINVAL;
|
|
}
|
|
|
|
@@ -169,6 +172,7 @@ int nn_ctcp_create (struct nn_ep *ep)
|
|
if (semicolon) {
|
|
rc = nn_iface_resolve (addr, semicolon - addr, ipv4only, &ss, &sslen);
|
|
if (rc < 0) {
|
|
+ nn_free (self);
|
|
return -ENODEV;
|
|
}
|
|
}
|