svn commit: r299814 - head/usr.sbin/bsnmpd/tools/libbsnmptools
Garrett Cooper
ngie at FreeBSD.org
Sun May 15 00:40:06 UTC 2016
Author: ngie
Date: Sun May 15 00:40:05 2016
New Revision: 299814
URL: https://svnweb.freebsd.org/changeset/base/299814
Log:
Replace malloc + memset(.., 0, ..) with calloc calls
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Modified:
head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
Modified: head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
==============================================================================
--- head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Sun May 15 00:35:35 2016 (r299813)
+++ head/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c Sun May 15 00:40:05 2016 (r299814)
@@ -55,12 +55,11 @@ snmp_mapping_init(void)
{
struct snmp_mappings *m;
- if ((m = malloc(sizeof(struct snmp_mappings))) == NULL) {
+ if ((m = calloc(1, sizeof(struct snmp_mappings))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (NULL);
}
- memset(m, 0, sizeof(struct snmp_mappings));
return (m);
}
@@ -478,13 +477,11 @@ snmp_syntax_insert(struct snmp_idxlist *
{
struct index *idx;
- if ((idx = malloc(sizeof(struct index))) == NULL) {
+ if ((idx = calloc(1, sizeof(struct index))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (-1);
}
- memset(idx, 0, sizeof(struct index));
-
if (snmp_index_insert(headp, idx) < 0) {
free(idx);
return (-1);
More information about the svn-src-all
mailing list