[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] [PATCH 20/41] cman: simplify code



Spotted by Coverity Scan

Signed-off-by: Fabio M. Di Nitto <fdinitto redhat com>
---
: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


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]