svn commit: r311754 - head/contrib/bsnmp/gensnmpdef

Ngie Cooper ngie at FreeBSD.org
Mon Jan 9 06:03:50 UTC 2017


Author: ngie
Date: Mon Jan  9 06:03:49 2017
New Revision: 311754
URL: https://svnweb.freebsd.org/changeset/base/311754

Log:
  Use calloc instead of malloc + memset(.., 0, ..)
  
  MFC after:	5 days

Modified:
  head/contrib/bsnmp/gensnmpdef/gensnmpdef.c

Modified: head/contrib/bsnmp/gensnmpdef/gensnmpdef.c
==============================================================================
--- head/contrib/bsnmp/gensnmpdef/gensnmpdef.c	Mon Jan  9 05:58:48 2017	(r311753)
+++ head/contrib/bsnmp/gensnmpdef/gensnmpdef.c	Mon Jan  9 06:03:49 2017	(r311754)
@@ -399,12 +399,11 @@ static void
 save_typdef(char *name)
 {
 	struct tdef *t;
-	t = malloc(sizeof(struct tdef));
 
+	t = calloc(1, sizeof(struct tdef));
 	if (t == NULL)
 		err(1, NULL);
 
-	memset(t, 0 , sizeof(struct tdef));
 	t->name = name;
 	SLIST_INSERT_HEAD(&tdefs, t, link);
 }


More information about the svn-src-all mailing list