MFC r298448,r298464:

r298448:

Don't leak `string` in parse_define(..) when a macro has been found
and the parser token != TOK_ASSIGN

CID: 1007187, 1007188
Obtained from: Isilon OneFS (part of r445479)

r298464:

Use `sizeof(*uuser)` instead of `sizeof(struct usm_user)` for consistency with
the rest of the users in the file

No functional change
This commit is contained in:
ngie 2016-05-04 00:25:20 +00:00
parent 26e1356c45
commit 2a062cd701
2 changed files with 3 additions and 2 deletions
contrib/bsnmp/snmpd

@ -1150,7 +1150,8 @@ parse_define(const char *varname)
free(m->value);
m->value = string;
m->length = length;
}
} else
free(string);
}
token = TOK_EOL;

@ -2813,7 +2813,7 @@ usm_new_user(uint8_t *eid, uint32_t elen, char *uname)
if ((uuser = (struct usm_user *)malloc(sizeof(*uuser))) == NULL)
return (NULL);
memset(uuser, 0, sizeof(struct usm_user));
memset(uuser, 0, sizeof(*uuser));
strlcpy(uuser->suser.sec_name, uname, SNMP_ADM_STR32_SIZ);
memcpy(uuser->user_engine_id, eid, elen);
uuser->user_engine_len = elen;