svn commit: r346000 - head/stand/common
Toomas Soome
tsoome at FreeBSD.org
Sun Apr 7 11:55:12 UTC 2019
Author: tsoome
Date: Sun Apr 7 11:55:11 2019
New Revision: 346000
URL: https://svnweb.freebsd.org/changeset/base/346000
Log:
loader: remove pointer checks before free() in module.c
free() does check for NULL argument, remove duplicate checks.
MFC after: 1w
Modified:
head/stand/common/module.c
Modified: head/stand/common/module.c
==============================================================================
--- head/stand/common/module.c Sun Apr 7 11:50:41 2019 (r345999)
+++ head/stand/common/module.c Sun Apr 7 11:55:11 2019 (r346000)
@@ -534,8 +534,7 @@ mod_load(char *modname, struct mod_depend *verinfo, in
mp = file_findmodule(NULL, modname, verinfo);
if (mp) {
#ifdef moduleargs
- if (mp->m_args)
- free(mp->m_args);
+ free(mp->m_args);
mp->m_args = unargv(argc, argv);
#endif
snprintf(command_errbuf, sizeof(command_errbuf),
@@ -961,18 +960,14 @@ file_discard(struct preloaded_file *fp)
}
mp = fp->f_modules;
while (mp) {
- if (mp->m_name)
- free(mp->m_name);
+ free(mp->m_name);
mp1 = mp;
mp = mp->m_next;
free(mp1);
}
- if (fp->f_name != NULL)
- free(fp->f_name);
- if (fp->f_type != NULL)
- free(fp->f_type);
- if (fp->f_args != NULL)
- free(fp->f_args);
+ free(fp->f_name);
+ free(fp->f_type);
+ free(fp->f_args);
free(fp);
}
@@ -1055,10 +1050,8 @@ moduledir_readhints(struct moduledir *mdp)
return;
bad:
close(fd);
- if (mdp->d_hints) {
- free(mdp->d_hints);
- mdp->d_hints = NULL;
- }
+ free(mdp->d_hints);
+ mdp->d_hints = NULL;
mdp->d_flags |= MDIR_NOHINTS;
return;
}
@@ -1119,8 +1112,7 @@ moduledir_rebuild(void)
if ((mdp->d_flags & MDIR_REMOVED) == 0) {
mdp = STAILQ_NEXT(mdp, d_link);
} else {
- if (mdp->d_hints)
- free(mdp->d_hints);
+ free(mdp->d_hints);
mtmp = mdp;
mdp = STAILQ_NEXT(mdp, d_link);
STAILQ_REMOVE(&moduledir_list, mtmp, moduledir, d_link);
More information about the svn-src-all
mailing list