From 264e429f2344900fd8fc90bf229db3435bc7f080 Mon Sep 17 00:00:00 2001 From: Dong Anyuan <donganyuan@cn.fujitsu.com> Date: Thu, 20 Jun 2019 12:37:08 +0900 Subject: [PATCH] Fix Coverity Scan CID 60351 (Variable sctp_cnx going out of scope leaks the storage it points to.) --- openair3/SCTP/sctp_eNB_task.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/openair3/SCTP/sctp_eNB_task.c b/openair3/SCTP/sctp_eNB_task.c index 54d96017b45..d8ffbe6dc9d 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; } -- GitLab