loader: malloc+bzero is calloc

Replace malloc+bzero in module.c with calloc.

MFC after:	1w
This commit is contained in:
Toomas Soome 2019-04-07 11:48:41 +00:00
parent ca19084f36
commit cef2742e20

View File

@ -926,10 +926,9 @@ file_addmodule(struct preloaded_file *fp, char *modname, int version,
mp = file_findmodule(fp, modname, &mdepend); mp = file_findmodule(fp, modname, &mdepend);
if (mp) if (mp)
return (EEXIST); return (EEXIST);
mp = malloc(sizeof(struct kernel_module)); mp = calloc(1, sizeof(struct kernel_module));
if (mp == NULL) if (mp == NULL)
return (ENOMEM); return (ENOMEM);
bzero(mp, sizeof(struct kernel_module));
mp->m_name = strdup(modname); mp->m_name = strdup(modname);
mp->m_version = version; mp->m_version = version;
mp->m_fp = fp; mp->m_fp = fp;
@ -980,12 +979,8 @@ file_discard(struct preloaded_file *fp)
struct preloaded_file * struct preloaded_file *
file_alloc(void) file_alloc(void)
{ {
struct preloaded_file *fp;
if ((fp = malloc(sizeof(struct preloaded_file))) != NULL) { return (calloc(1, sizeof(struct preloaded_file)));
bzero(fp, sizeof(struct preloaded_file));
}
return (fp);
} }
/* /*