From: Jim Meyering <[email protected]>

* 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;
 }
-
-- 
1.6.3.3.420.gd4b46

Reply via email to