diff options
author | Enji Cooper <ngie@FreeBSD.org> | 2016-05-14 20:25:14 +0000 |
---|---|---|
committer | Enji Cooper <ngie@FreeBSD.org> | 2016-05-14 20:25:14 +0000 |
commit | 031987d916a64d18e60e5fe00419d581faee5d9d (patch) | |
tree | 26d0d42e70e1197b06ebc23c7c173fa832f2b22b /usr.sbin/bsnmpd/tools | |
parent | c68e865e8fd8600114a4f0a58a7c470e49bee47a (diff) | |
download | src-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.c | 7 |
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); |