summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c')
-rw-r--r--usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c7
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);
OpenPOWER on IntegriCloud