summaryrefslogtreecommitdiffstats
path: root/usr.sbin/bsnmpd
diff options
context:
space:
mode:
authorngie <ngie@FreeBSD.org>2016-05-15 00:02:55 +0000
committerngie <ngie@FreeBSD.org>2016-05-15 00:02:55 +0000
commit4c341e65921bfa8c60092a4bbe9562ae69e61d84 (patch)
tree7fdc6eb1506a16c57e8c560b0e6f0743bc804f67 /usr.sbin/bsnmpd
parentb525fce336667f88a6a3d25089de1964d25f65cb (diff)
downloadFreeBSD-src-4c341e65921bfa8c60092a4bbe9562ae69e61d84.zip
FreeBSD-src-4c341e65921bfa8c60092a4bbe9562ae69e61d84.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.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 175e660..dc24783 100644
--- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
+++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmpmap.c
@@ -268,13 +268,11 @@ enum_pair_insert(struct enum_pairs *headp, int32_t enum_val, char *enum_str)
{
struct enum_pair *e_new;
- if ((e_new = malloc(sizeof(struct enum_pair))) == NULL) {
+ if ((e_new = calloc(1, sizeof(struct enum_pair))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (-1);
}
- memset(e_new, 0, sizeof(struct enum_pair));
-
if ((e_new->enum_str = malloc(strlen(enum_str) + 1)) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
free(e_new);
@@ -557,12 +555,11 @@ snmp_enumtc_init(char *name)
{
struct enum_type *enum_tc;
- if ((enum_tc = malloc(sizeof(struct enum_type))) == NULL) {
+ if ((enum_tc = calloc(1, sizeof(struct enum_type))) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
return (NULL);
}
- memset(enum_tc, 0, sizeof(struct enum_type));
if ((enum_tc->name = malloc(strlen(name) + 1)) == NULL) {
syslog(LOG_ERR, "malloc() failed: %s", strerror(errno));
free(enum_tc);
OpenPOWER on IntegriCloud