svn commit: r346001 - head/stand/common
Toomas Soome
tsoome at FreeBSD.org
Tue Sep 3 14:06:51 UTC 2019
Author: tsoome
Date: Sun Apr 7 12:10:19 2019
New Revision: 346001
URL: https://svnweb.freebsd.org/changeset/base/346001
Log:
loader: file_addmetadata() should check for memory allocation
malloc() 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:55:11 2019 (r346000)
+++ head/stand/common/module.c Sun Apr 7 12:10:19 2019 (r346001)
@@ -677,10 +677,12 @@ file_addmetadata(struct preloaded_file *fp, int type,
struct file_metadata *md;
md = malloc(sizeof(struct file_metadata) - sizeof(md->md_data) + size);
- md->md_size = size;
- md->md_type = type;
- bcopy(p, md->md_data, size);
- md->md_next = fp->f_metadata;
+ if (md != NULL) {
+ md->md_size = size;
+ md->md_type = type;
+ bcopy(p, md->md_data, size);
+ md->md_next = fp->f_metadata;
+ }
fp->f_metadata = md;
}
More information about the svn-src-all
mailing list