summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ecp/server/dir.c6
-rw-r--r--ecp/server/vlink.c5
-rw-r--r--ecp/server/vlink.h1
3 files changed, 10 insertions, 2 deletions
diff --git a/ecp/server/dir.c b/ecp/server/dir.c
index c045599..b941050 100644
--- a/ecp/server/dir.c
+++ b/ecp/server/dir.c
@@ -497,7 +497,10 @@ int dir_open_conn(DIRNode *node, ECPSocket *sock) {
ecp_conn_set_flags(node->conn, ECP_CONN_FLAG_VBOX);
rv = ecp_conn_open(node->conn, &node->dir_item.node);
- if (rv) node->conn = NULL;
+ if (rv) {
+ free(node->conn);
+ node->conn = NULL;
+ }
return rv;
}
@@ -932,6 +935,7 @@ int dir_init_ann(ECPSocket *sock, ECPNode *node) {
ecp_conn_set_flags(conn, ECP_CONN_FLAG_VBOX);
rv = ecp_conn_open(conn, node);
if (rv) {
+ free(conn);
LOG(LOG_ERR, "dir_init_ann: conn open err:%d\n", rv);
return rv;
}
diff --git a/ecp/server/vlink.c b/ecp/server/vlink.c
index fcb9a5c..445734c 100644
--- a/ecp/server/vlink.c
+++ b/ecp/server/vlink.c
@@ -33,7 +33,10 @@ int vlink_open_conn(ECPSocket *sock, ECPNode *node, ECPConnection **_conn) {
ecp_vlink_init(conn, sock);
rv = ecp_conn_open(conn, node);
- if (rv) return rv;
+ if (rv) {
+ free(conn);
+ return rv;
+ }
*_conn = conn;
return ECP_OK;
diff --git a/ecp/server/vlink.h b/ecp/server/vlink.h
index 3e8022f..b591d11 100644
--- a/ecp/server/vlink.h
+++ b/ecp/server/vlink.h
@@ -1,6 +1,7 @@
#define MAX_KEYX_CNT 100
#define KEYX_PERIOD 600 /* key exchange priod (s); can't exceed 1h */
+
#define VLINK_UFLAG_DISCONNECT 0x80
int vlink_open_conn(ECPSocket *sock, ECPNode *node, ECPConnection **_conn);