Author: tsoome
Date: Sun Apr  7 11:50:41 2019
New Revision: 345999
URL: https://svnweb.freebsd.org/changeset/base/345999

Log:
  loader: file_addmodule should check for memory allocation
  
  strdup() can return NULL.
  
  MFC after:    1w

Modified:
  head/stand/common/module.c

Modified: head/stand/common/module.c
==============================================================================
--- head/stand/common/module.c  Sun Apr  7 11:48:41 2019        (r345998)
+++ head/stand/common/module.c  Sun Apr  7 11:50:41 2019        (r345999)
@@ -930,6 +930,10 @@ file_addmodule(struct preloaded_file *fp, char *modnam
        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;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to