Use calloc instead of malloc + memset(.., 0, ..)
MFC after: 5 days
This commit is contained in:
parent
c5f8d75113
commit
8406423362
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=311754
@ -399,12 +399,11 @@ static void
|
|||||||
save_typdef(char *name)
|
save_typdef(char *name)
|
||||||
{
|
{
|
||||||
struct tdef *t;
|
struct tdef *t;
|
||||||
t = malloc(sizeof(struct tdef));
|
|
||||||
|
|
||||||
|
t = calloc(1, sizeof(struct tdef));
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
err(1, NULL);
|
err(1, NULL);
|
||||||
|
|
||||||
memset(t, 0 , sizeof(struct tdef));
|
|
||||||
t->name = name;
|
t->name = name;
|
||||||
SLIST_INSERT_HEAD(&tdefs, t, link);
|
SLIST_INSERT_HEAD(&tdefs, t, link);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user