diff options
author | ngie <ngie@FreeBSD.org> | 2016-05-15 00:40:05 +0000 |
---|---|---|
committer | ngie <ngie@FreeBSD.org> | 2016-05-15 00:40:05 +0000 |
commit | 5337d6c8e9387311b94c9e2f51296bc7bf6cfad8 (patch) | |
tree | 06d440a114dfaac4354c24b2a932544835738ff2 /usr.sbin/bsnmpd | |
parent | d29efb63dcc4bc6f56b6e10e085ca0e9c17f21b9 (diff) | |
download | FreeBSD-src-5337d6c8e9387311b94c9e2f51296bc7bf6cfad8.zip FreeBSD-src-5337d6c8e9387311b94c9e2f51296bc7bf6cfad8.tar.gz |
Replace malloc + memset(.., 0, ..) with calloc calls
MFC after: 1 week
Sponsored by: EMC / Isilon Storage Division
Diffstat (limited to 'usr.sbin/bsnmpd')
-rw-r--r-- | usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c index 07fc83b..7e2b721 100644 --- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c +++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c @@ -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 *headp, struct enum_pairs *enums, { 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); |