From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabio M. Di Nitto Date: Wed, 23 Nov 2011 11:15:39 +0100 Subject: [Cluster-devel] [PATCH 20/41] cman: simplify code In-Reply-To: <1322043360-17037-1-git-send-email-fdinitto@redhat.com> References: <1322043360-17037-1-git-send-email-fdinitto@redhat.com> Message-ID: List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Spotted by Coverity Scan Signed-off-by: Fabio M. Di Nitto --- :100644 100644 7641294... 284b351... M cman/daemon/commands.c cman/daemon/commands.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/cman/daemon/commands.c b/cman/daemon/commands.c index 7641294..284b351 100644 --- a/cman/daemon/commands.c +++ b/cman/daemon/commands.c @@ -270,13 +270,12 @@ static struct cluster_node *add_new_node(char *name, int nodeid, int votes, int newnode->incarnation = incarnation; } if (!newnode->name) { - newnode->name = malloc(strlen(name)+1); + newnode->name = strdup(name); if (!newnode->name) { if (newalloc) free(newnode); return NULL; } - strcpy(newnode->name, name); } if (!newnode->node_id) /* Don't clobber existing nodeid */ -- 1.7.4.4