Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/gen Use calloc(1, ...) instead of malloc(...) follo...



details:   https://anonhg.NetBSD.org/src/rev/6fae52a9edfc
branches:  trunk
changeset: 345528:6fae52a9edfc
user:      pgoyette <pgoyette%NetBSD.org@localhost>
date:      Tue May 31 07:49:09 2016 +0000

description:
Use calloc(1, ...) instead of malloc(...) followed immediately by memset()

Addresses PR lib/46818

diffstat:

 lib/libc/gen/fts.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (29 lines):

diff -r 0e9f1323ee66 -r 6fae52a9edfc lib/libc/gen/fts.c
--- a/lib/libc/gen/fts.c        Tue May 31 06:55:02 2016 +0000
+++ b/lib/libc/gen/fts.c        Tue May 31 07:49:09 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fts.c,v 1.48 2015/01/29 15:55:21 manu Exp $    */
+/*     $NetBSD: fts.c,v 1.49 2016/05/31 07:49:09 pgoyette Exp $        */
 
 /*-
  * Copyright (c) 1990, 1993, 1994
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)fts.c      8.6 (Berkeley) 8/14/94";
 #else
-__RCSID("$NetBSD: fts.c,v 1.48 2015/01/29 15:55:21 manu Exp $");
+__RCSID("$NetBSD: fts.c,v 1.49 2016/05/31 07:49:09 pgoyette Exp $");
 #endif
 #endif /* LIBC_SCCS and not lint */
 
@@ -133,9 +133,8 @@
        }
 
        /* Allocate/initialize the stream */
-       if ((sp = malloc(sizeof(FTS))) == NULL)
+       if ((sp = calloc(1, sizeof(FTS))) == NULL)
                return (NULL);
-       memset(sp, 0, sizeof(FTS));
        sp->fts_compar = compar;
        sp->fts_options = options;
 



Home | Main Index | Thread Index | Old Index