Thread (14 messages) 14 messages, 2 authors, 2012-03-21

[PATCH 04/11] match_metadata_desc1(): Use calloc instead of malloc+memset

flat view
STALE5318d

From: <hidden>
Date: 2012-03-20 16:54:09
Subsystem: the rest · Maintainer: Linus Torvalds

From: Jes Sorensen <redacted>

Signed-off-by: Jes Sorensen <redacted>
---
 super1.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/super1.c b/super1.c
index 1f0c8bc..ca9e4e4 100644
--- a/super1.c
+++ b/super1.c
@@ -1401,10 +1401,10 @@ static int load_super1(struct supertype *st, int fd, char *devname)
 
 static struct supertype *match_metadata_desc1(char *arg)
 {
-	struct supertype *st = malloc(sizeof(*st));
-	if (!st) return st;
+	struct supertype *st = calloc(1, sizeof(*st));
+	if (!st)
+		return st;
 
-	memset(st, 0, sizeof(*st));
 	st->container_dev = NoMdDev;
 	st->ss = &super1;
 	st->max_devs = 384;
-- 
1.7.7.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help