jim         96/09/12 17:24:54

  Modified:    src       http_main.c alloc.c
  Log:
  simple error checking for malloc()
  
  Revision  Changes    Path
  1.67      +5 -1      apache/src/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_main.c,v
  retrieving revision 1.66
  retrieving revision 1.67
  diff -C3 -r1.66 -r1.67
  *** http_main.c       1996/09/08 17:24:55     1.66
  --- http_main.c       1996/09/13 00:24:50     1.67
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: http_main.c,v 1.66 1996/09/08 17:24:55 ben Exp $ */
    
    /*
     * httpd.c: simple http daemon for answering WWW file requests
  --- 50,56 ----
     *
     */
    
  ! /* $Id: http_main.c,v 1.67 1996/09/13 00:24:50 jim Exp $ */
    
    /*
     * httpd.c: simple http daemon for answering WWW file requests
  ***************
  *** 1655,1660 ****
  --- 1655,1664 ----
        for(lr=listeners ; lr ; lr=lr->next)
        {
        listen_rec *nr=malloc(sizeof *nr);
  +     if (nr == NULL) {
  +       fprintf (stderr, "Ouch!  malloc failed in copy_listeners()\n");
  +       exit (1);
  +     }
        *nr=*lr;
        kill_cleanups_for_fd(p,nr->fd);
        nr->next=old_listeners;
  
  
  
  1.12      +5 -3      apache/src/alloc.c
  
  Index: alloc.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/alloc.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -C3 -r1.11 -r1.12
  *** alloc.c   1996/08/20 10:51:01     1.11
  --- alloc.c   1996/09/13 00:24:51     1.12
  ***************
  *** 50,56 ****
     *
     */
    
  ! /* $Id: alloc.c,v 1.11 1996/08/20 10:51:01 paul Exp $ */
    
    
    /*
  --- 50,56 ----
     *
     */
    
  ! /* $Id: alloc.c,v 1.12 1996/09/13 00:24:51 jim Exp $ */
    
    
    /*
  ***************
  *** 109,116 ****
      union block_hdr *blok =
        (union block_hdr *)malloc(size + sizeof(union block_hdr));
    
  !   if (blok == NULL) return NULL;
  !   
      blok->h.next = NULL;
      blok->h.first_avail = (char *)(blok + 1);
      blok->h.endp = size + blok->h.first_avail;
  --- 109,118 ----
      union block_hdr *blok =
        (union block_hdr *)malloc(size + sizeof(union block_hdr));
    
  !   if (blok == NULL) {
  !       fprintf (stderr, "Ouch!  malloc failed in malloc_block()\n");
  !       exit (1);
  !   }
      blok->h.next = NULL;
      blok->h.first_avail = (char *)(blok + 1);
      blok->h.endp = size + blok->h.first_avail;
  
  
  

Reply via email to