From: Jes.Sorensen@redhat.com
To: neilb@suse.de
Cc: linux-raid@vger.kernel.org, dledford@redhat.com
Subject: [PATCH 2/2] Create() check malloc() return value
Date: Fri, 21 Oct 2011 17:15:59 +0200 [thread overview]
Message-ID: <1319210159-8711-2-git-send-email-Jes.Sorensen@redhat.com> (raw)
In-Reply-To: <1319210159-8711-1-git-send-email-Jes.Sorensen@redhat.com>
From: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
---
Create.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/Create.c b/Create.c
index 3e85785..5d1548b 100644
--- a/Create.c
+++ b/Create.c
@@ -790,6 +790,10 @@ int Create(struct supertype *st, char *mddev,
}
infos = malloc(sizeof(*infos) * total_slots);
+ if (!infos) {
+ fprintf(stderr, Name ": Unable to allocate memory\n");
+ goto abort;
+ }
for (pass=1; pass <=2 ; pass++) {
struct mddev_dev *moved_disk = NULL; /* the disk that was moved out of the insert point */
--
1.7.4.4
prev parent reply other threads:[~2011-10-21 15:15 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-21 15:15 [PATCH 1/2] Create() don't leave the lock hanging on error Jes.Sorensen
2011-10-21 15:15 ` Jes.Sorensen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319210159-8711-2-git-send-email-Jes.Sorensen@redhat.com \
--to=jes.sorensen@redhat.com \
--cc=dledford@redhat.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).