diff options
author | Artur Wojcik <artur.wojcik@intel.com> | 2009-12-10 12:03:37 -0700 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2009-12-10 12:03:37 -0700 |
commit | 0fbd635caa86a027dbe88c4739dc00a27e29135e (patch) | |
tree | 182a16f68fda8ef70fc0905cbe2b0de5207c5b6b /super-intel.c | |
parent | 5a1920f2c26719d825521cfe6a2b78f4ff6eed99 (diff) |
Fix for possible NULL pointer dereference.
Pointer 'this' returned from call to function 'malloc' at line 3795
may be NULL and will be dereferenced at line 3796.
Artur Wojcik <artur.wojcik@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'super-intel.c')
-rw-r--r-- | super-intel.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/super-intel.c b/super-intel.c index 2e119f83..5e8378f9 100644 --- a/super-intel.c +++ b/super-intel.c @@ -3804,6 +3804,11 @@ static struct mdinfo *container_content_imsm(struct supertype *st) } this = malloc(sizeof(*this)); + if (!this) { + fprintf(stderr, Name ": failed to allocate %lu bytes\n", + sizeof(*this)); + break; + } memset(this, 0, sizeof(*this)); this->next = rest; @@ -3821,7 +3826,7 @@ static struct mdinfo *container_content_imsm(struct supertype *st) ord = get_imsm_ord_tbl_ent(dev, slot); for (d = super->disks; d ; d = d->next) if (d->index == idx) - break; + break; if (d == NULL) skip = 1; |