summaryrefslogtreecommitdiff
path: root/usr.sbin/bsnmpd/tools
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2016-05-14 20:25:14 +0000
committerEnji Cooper <ngie@FreeBSD.org>2016-05-14 20:25:14 +0000
commit031987d916a64d18e60e5fe00419d581faee5d9d (patch)
tree26d0d42e70e1197b06ebc23c7c173fa832f2b22b /usr.sbin/bsnmpd/tools
parentc68e865e8fd8600114a4f0a58a7c470e49bee47a (diff)
downloadsrc-test2-031987d916a64d18e60e5fe00419d581faee5d9d.tar.gz
src-test2-031987d916a64d18e60e5fe00419d581faee5d9d.zip
Notes
Diffstat (limited to 'usr.sbin/bsnmpd/tools')
-rw-r--r--usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
index c9353d83c1a2..eedfe625ec4e 100644
--- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
+++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c
@@ -256,14 +256,12 @@ add_filename(struct snmp_toolinfo *snmptoolctx, const char *filename,
return (-1);
}
- if ((entry = malloc(sizeof(struct fname))) == NULL) {
+ if ((entry = calloc(1, sizeof(struct fname))) == NULL) {
warnx("malloc() failed - %s", strerror(errno));
free(fstring);
return (-1);
}
- memset(entry, 0, sizeof(struct fname));
-
if (cut != NULL)
asn_append_oid(&(entry->cut), cut);
strlcpy(fstring, filename, strlen(filename) + 1);
@@ -1366,12 +1364,11 @@ snmp_object_add(struct snmp_toolinfo *snmptoolctx, snmp_verify_inoid_f func,
return (-1);
}
- if ((obj = malloc(sizeof(struct snmp_object))) == NULL) {
+ if ((obj = calloc(1, sizeof(struct snmp_object))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (-1);
}
- memset(obj, 0, sizeof(struct snmp_object));
if (func(snmptoolctx, obj, string) < 0) {
warnx("Invalid OID - %s", string);
free(obj);