You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ji...@hyperreal.org on 1999/02/20 19:12:38 UTC

cvs commit: apache-1.3/src/main buff.c http_config.c http_main.c util.c

jim         99/02/20 10:12:37

  Modified:    .        STATUS
               src      CHANGES
               src/main buff.c http_config.c http_main.c util.c
  Log:
  Added informative error messages when malloc()
  fails... some of these most probably should also exit :/
  
  Revision  Changes    Path
  1.629     +1 -5      apache-1.3/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/STATUS,v
  retrieving revision 1.628
  retrieving revision 1.629
  diff -u -r1.628 -r1.629
  --- STATUS	1999/02/20 17:57:50	1.628
  +++ STATUS	1999/02/20 18:12:31	1.629
  @@ -1,5 +1,5 @@
     1.3 STATUS:
  -  Last modified at [$Date: 1999/02/20 17:57:50 $]
  +  Last modified at [$Date: 1999/02/20 18:12:31 $]
   
   Release:
   
  @@ -62,10 +62,6 @@
         Allows use of C-style backslash escapes in mod_log_config format strings
           MID: <E1...@fanf.noc.demon.net>
           Status: 
  -
  -    * John Bley's [PATCH] malloc checks
  -        MID: <Pi...@soc11.acpub.duke.edu>
  -        Status: Jim -0 (maybe the messages could be more detailed?)
   
       * Ralf's [PATCH] Shared Memory Pools
           Message-ID: <19...@engelschall.com>
  
  
  
  1.1256    +3 -0      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1255
  retrieving revision 1.1256
  diff -u -r1.1255 -r1.1256
  --- CHANGES	1999/02/20 17:57:51	1.1255
  +++ CHANGES	1999/02/20 18:12:32	1.1256
  @@ -1,5 +1,8 @@
   Changes with Apache 1.3.5
   
  +  *) Added some informative error messages for some failed malloc()
  +     calls. [John Bley <jb...@acpub.duke.edu>, Jim Jagielski]
  +
     *) OS/2 ap_os_canonical_filename()'s behaviour is improved: ap_assert()
        is removed. This allows <Directory proxy:*> directives to work and
        prevents invalid requests from killing the process.
  
  
  
  1.86      +3 -1      apache-1.3/src/main/buff.c
  
  Index: buff.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/buff.c,v
  retrieving revision 1.85
  retrieving revision 1.86
  diff -u -r1.85 -r1.86
  --- buff.c	1999/01/01 19:04:47	1.85
  +++ buff.c	1999/02/20 18:12:34	1.86
  @@ -1233,8 +1233,10 @@
               if (cbuf != NULL)
                   free(cbuf);
               cbuf = malloc(csize = nbyte+HUGE_STRING_LEN);
  -            if (cbuf == NULL)
  +            if (cbuf == NULL) {
  +                fprintf(stderr, "Ouch!  Out of memory in ap_bwrite()!\n");
                   csize = 0;
  +            }
           }
           ebcdic2ascii((cbuf) ? cbuf : (void*)buf, buf, nbyte);
           buf = (cbuf) ? cbuf : buf;
  
  
  
  1.141     +6 -0      apache-1.3/src/main/http_config.c
  
  Index: http_config.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_config.c,v
  retrieving revision 1.140
  retrieving revision 1.141
  diff -u -r1.140 -r1.141
  --- http_config.c	1999/01/01 19:04:48	1.140
  +++ http_config.c	1999/02/20 18:12:35	1.141
  @@ -327,6 +327,9 @@
   	}
       }
       method_ptrs = malloc((how_many_ptrs + NMETHODS) * sizeof(handler_func));
  +    if (method_ptrs == NULL) {
  +	fprintf(stderr, "Ouch!  Out of memory in build_method_shortcuts()!\n");
  +    }
       next_ptr = 0;
       for (i = 0; i < NMETHODS; ++i) {
   	/* XXX: This is an itsy bit presumptuous about the alignment
  @@ -693,6 +696,9 @@
        */
       ap_loaded_modules = (module **)malloc(
           sizeof(module *)*(total_modules+DYNAMIC_MODULE_LIMIT+1));
  +    if (ap_loaded_modules == NULL) {
  +	fprintf(stderr, "Ouch!  Out of memory in ap_setup_prelinked_modules()!\n");
  +    }
       for (m = ap_preloaded_modules, m2 = ap_loaded_modules; *m != NULL; )
           *m2++ = *m++;
       *m2 = NULL;
  
  
  
  1.423     +9 -0      apache-1.3/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/http_main.c,v
  retrieving revision 1.422
  retrieving revision 1.423
  diff -u -r1.422 -r1.423
  --- http_main.c	1999/02/09 13:18:19	1.422
  +++ http_main.c	1999/02/20 18:12:35	1.423
  @@ -1544,6 +1544,9 @@
   {
       ap_assert(!ap_scoreboard_image);
       ap_scoreboard_image = (scoreboard *) malloc(SCOREBOARD_SIZE);
  +    if (ap_scoreboard_image == NULL) {
  +	fprintf(stderr, "Ouch!  Out of memory reiniting scoreboard!\n");
  +    }
       memset(ap_scoreboard_image, 0, SCOREBOARD_SIZE);
   }
   
  @@ -4809,6 +4812,9 @@
       /* TODO: If too many jobs in queue, sleep, check for problems */
       ap_acquire_mutex(allowed_globals.jobmutex);
       new_job = (joblist *) malloc(sizeof(joblist));
  +    if (new_jobs == NULL) {
  +	fprintf(stderr, "Ouch!  Out of memory in add_job()!\n");
  +    }
       new_job->next = NULL;
       new_job->sock = sock;
       if (allowed_globals.jobtail != NULL)
  @@ -6119,6 +6125,9 @@
       }
       if (llp_slot == NULL) {
   	envpnew = (char **)malloc(sizeof(char *)*(i + 2));
  +	if (envpnew == NULL) {
  +	    fprintf(stderr, "Ouch!  Out of memory generating envpnew!\n");
  +	}
   	memcpy(envpnew, envp, sizeof(char *)*i);
   	envp = envpnew;
   	llp_slot = &envp[i++];
  
  
  
  1.153     +3 -1      apache-1.3/src/main/util.c
  
  Index: util.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/main/util.c,v
  retrieving revision 1.152
  retrieving revision 1.153
  diff -u -r1.152 -r1.153
  --- util.c	1999/02/11 16:24:09	1.152
  +++ util.c	1999/02/20 18:12:35	1.153
  @@ -1625,8 +1625,10 @@
   {
       char *sdup;
   
  -    if (!(sdup = (char *) malloc(strlen(str) + 1)))
  +    if (!(sdup = (char *) malloc(strlen(str) + 1))) {
  +	fprintf(stderr, "Ouch!  Out of memory in our strdup()!\n");
   	return NULL;
  +    }
       sdup = strcpy(sdup, str);
   
       return sdup;