mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-15 12:54:27 +00:00
loader: file_addmodule should check for memory allocation
strdup() can return NULL. MFC after: 1w
This commit is contained in:
parent
cef2742e20
commit
db7599e9e5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=345999
|
@ -930,6 +930,10 @@ file_addmodule(struct preloaded_file *fp, char *modname, int version,
|
|||
if (mp == NULL)
|
||||
return (ENOMEM);
|
||||
mp->m_name = strdup(modname);
|
||||
if (mp->m_name == NULL) {
|
||||
free(mp);
|
||||
return (ENOMEM);
|
||||
}
|
||||
mp->m_version = version;
|
||||
mp->m_fp = fp;
|
||||
mp->m_next = fp->f_modules;
|
||||
|
|
Loading…
Reference in a new issue