Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 9 Jan 2017 06:03:49 +0000 (UTC)
From:      Ngie Cooper <ngie@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311754 - head/contrib/bsnmp/gensnmpdef
Message-ID:  <201701090603.v0963nCc008435@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701090603.v0963nCc008435>