From 7a7c2afa1100cad89cc5e8bb661a8fd1def2a22d Mon Sep 17 00:00:00 2001
From: Robert Schmidt <robert.schmidt@eurecom.fr>
Date: Wed, 6 Mar 2019 13:59:39 +0100
Subject: [PATCH] Handle cppcheck errors in ASYNC_IF

---
 openair2/UTIL/ASYNC_IF/socket_link.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/openair2/UTIL/ASYNC_IF/socket_link.c b/openair2/UTIL/ASYNC_IF/socket_link.c
index 3c043f85df..e40fba4a04 100644
--- a/openair2/UTIL/ASYNC_IF/socket_link.c
+++ b/openair2/UTIL/ASYNC_IF/socket_link.c
@@ -222,7 +222,7 @@ socket_link_t *new_link_udp_client(const char *server, int port){
   ret = calloc(1, sizeof(socket_link_t));
   if (ret == NULL) {
     LOG_E(MAC, "%s:%d: out of memory\n", __FILE__, __LINE__);
-    //goto error;
+    goto error;
   }
   ret->socket_fd = -1;
 
@@ -253,8 +253,10 @@ socket_link_t *new_link_udp_client(const char *server, int port){
  
   return ret;
 error:
-  if (ret != NULL) close(ret->socket_fd);
-  free(ret);
+  if (ret != NULL) {
+    close(ret->socket_fd);
+    free(ret);
+  }
   LOG_E(MAC, "ERROR in new_link_udp_client (see above), returning NULL\n");
   return NULL;
 }
-- 
GitLab