public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* cluster: STABLE3 - dlm/tests: handle malloc failure
@ 2009-06-25 9:02 Jim Meyering
0 siblings, 0 replies; only message in thread
From: Jim Meyering @ 2009-06-25 9:02 UTC (permalink / raw)
To: cluster-cvs-relay
Gitweb: http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=a0cbf283f445712fe358318ed39fb63aa85c3d78
Commit: a0cbf283f445712fe358318ed39fb63aa85c3d78
Parent: 2088d2121cf0a8ff5ea0e021b8b76d94d20b08d0
Author: Jim Meyering <meyering@redhat.com>
AuthorDate: Mon Jun 22 23:52:18 2009 +0200
Committer: Jim Meyering <meyering@redhat.com>
CommitterDate: Thu Jun 25 11:00:05 2009 +0200
dlm/tests: handle malloc failure
* dlm/tests/usertest/flood.c (main): Handle malloc failure.
---
dlm/tests/usertest/flood.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/dlm/tests/usertest/flood.c b/dlm/tests/usertest/flood.c
index efe3a4b..c01bc0d 100644
--- a/dlm/tests/usertest/flood.c
+++ b/dlm/tests/usertest/flood.c
@@ -112,7 +112,11 @@ int main(int argc, char *argv[])
}
}
- resources = malloc(sizeof(char*) * rescount);
+ if ((resources = malloc(sizeof(char*) * rescount)) == NULL)
+ {
+ perror("exhausted virtual memory");
+ return 1;
+ }
for (i=0; i < rescount; i++) {
char resname[256];
sprintf(resname, "TESTLOCK%d", i);
@@ -164,4 +168,3 @@ int main(int argc, char *argv[])
return 0;
}
-
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-06-25 9:02 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-25 9:02 cluster: STABLE3 - dlm/tests: handle malloc failure Jim Meyering
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 read-only IMAP folder(s) and NNTP newsgroup(s).