From cef2742e201bd57eca86bef0033b52110924af40 Mon Sep 17 00:00:00 2001 From: Toomas Soome Date: Sun, 7 Apr 2019 11:48:41 +0000 Subject: [PATCH] loader: malloc+bzero is calloc Replace malloc+bzero in module.c with calloc. MFC after: 1w --- stand/common/module.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/stand/common/module.c b/stand/common/module.c index dfce002323a4..1462e9973274 100644 --- a/stand/common/module.c +++ b/stand/common/module.c @@ -926,10 +926,9 @@ file_addmodule(struct preloaded_file *fp, char *modname, int version, mp = file_findmodule(fp, modname, &mdepend); if (mp) return (EEXIST); - mp = malloc(sizeof(struct kernel_module)); + mp = calloc(1, sizeof(struct kernel_module)); if (mp == NULL) return (ENOMEM); - bzero(mp, sizeof(struct kernel_module)); mp->m_name = strdup(modname); mp->m_version = version; mp->m_fp = fp; @@ -980,12 +979,8 @@ file_discard(struct preloaded_file *fp) struct preloaded_file * file_alloc(void) { - struct preloaded_file *fp; - if ((fp = malloc(sizeof(struct preloaded_file))) != NULL) { - bzero(fp, sizeof(struct preloaded_file)); - } - return (fp); + return (calloc(1, sizeof(struct preloaded_file))); } /*