From 140f805d9262802985b52a09ee6cfe34a55a30ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?Andr=C3=A9=20Malo?= Date: Thu, 3 Jul 2003 16:07:21 +0000 Subject: [PATCH] catch out of memory condition (ID 29 of reasoning report) git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@100447 13f79535-47bb-0310-9956-ffa450edef68 --- support/ab.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/support/ab.c b/support/ab.c index 2af5d16f34..d17902ee24 100644 --- a/support/ab.c +++ b/support/ab.c @@ -1642,7 +1642,11 @@ static void test(void) * Combine headers and (optional) post file into one contineous buffer */ if (posting == 1) { - char *buff = (char *) malloc(postlen + reqlen + 1); + char *buff = malloc(postlen + reqlen + 1); + if (!buff) { + fprintf(stderr, "error creating request buffer: out of memory\n"); + return; + } strcpy(buff, request); strcpy(buff + reqlen, postdata); request = buff; @@ -1786,14 +1790,14 @@ static void test(void) static void copyright(void) { if (!use_html) { - printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.124 $> apache-2.0"); + printf("This is ApacheBench, Version %s\n", AP_AB_BASEREVISION " <$Revision: 1.125 $> apache-2.0"); printf("Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/\n"); printf("Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/\n"); printf("\n"); } else { printf("

\n"); - printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.124 $"); + printf(" This is ApacheBench, Version %s <%s> apache-2.0
\n", AP_AB_BASEREVISION, "$Revision: 1.125 $"); printf(" Copyright (c) 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
\n"); printf(" Copyright (c) 1998-2002 The Apache Software Foundation, http://www.apache.org/
\n"); printf("

\n

\n"); -- 2.50.1