From 31269dde52852baeedbc9fd34c31e4b3863dbc4c Mon Sep 17 00:00:00 2001 From: francesco_carli <62562180+fcarli3@users.noreply.github.com> Date: Fri, 25 Sep 2020 12:19:20 +0200 Subject: [PATCH] Update sn_utils.c --- src/sn_utils.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/sn_utils.c b/src/sn_utils.c index 0de9f18..e241199 100644 --- a/src/sn_utils.c +++ b/src/sn_utils.c @@ -204,9 +204,6 @@ static int try_broadcast(n2n_sn_t * sss, /** Initialise some fields of the community structure **/ int comm_init(struct sn_community *comm, char *cmn){ - - comm = (struct sn_community*)malloc(sizeof(struct sn_community)); - memset(comm, 0, sizeof(struct sn_community)); strncpy((char*)comm->community, cmn, N2N_COMMUNITY_SIZE-1); comm->community[N2N_COMMUNITY_SIZE-1] = '\0'; @@ -983,6 +980,7 @@ static int process_udp(n2n_sn_t * sss, if(!comm && (!sss->lock_communities || (match == 1))) { + comm = (struct sn_community*)calloc(1,sizeof(struct sn_community)); comm_init(comm,(char *)cmn.community); if(comm) {