diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 54d96017b45496a4b0cf31271a276fc4ab4ed78f..d8ffbe6dc9d6fa26c42252dd8178c044eea988d4 100644 --- a/openair3/SCTP/sctp_eNB_task.c +++ b/openair3/SCTP/sctp_eNB_task.c @@ -800,11 +800,15 @@ static int sctp_create_new_listener( if (sctp_bindx(sd, addr, used_addresses, SCTP_BINDX_ADD_ADDR) != 0) { SCTP_ERROR("sctp_bindx: %s:%d\n", strerror(errno), errno); + free(sctp_cnx); + sctp_cnx = NULL; return -1; } if (listen(sd, 5) < 0) { SCTP_ERROR("listen: %s:%d\n", strerror(errno), errno); + free(sctp_cnx); + sctp_cnx = NULL; return -1; } @@ -823,6 +827,11 @@ err: sd = -1; } + if (sctp_cnx != NULL) { + free(sctp_cnx); + sctp_cnx = NULL; + } + return -1; }