apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apr/shmem/unix shmem.c
Date Thu, 30 Aug 2001 02:30:48 GMT
jerenkrantz    01/08/29 19:30:48

  Modified:    shmem/unix shmem.c
  Log:
  Fix a segfault when we try to memset NULL (the user is out of memory in
  that shared memory segment).
  
  apr_shm_malloc will either return valid memory or NULL, so this is a
  useful check.  When using libc's malloc(), that isn't necessarily the
  case.  However, this patch requires the caller to check for a NULL
  return which they probably don't do anyway, so the segfault gets
  moved out of APR and into the caller.  That's good enough for now...
  
  PR:	Graham's posts to dev@apr
  
  Revision  Changes    Path
  1.31      +2 -1      apr/shmem/unix/shmem.c
  
  Index: shmem.c
  ===================================================================
  RCS file: /home/cvs/apr/shmem/unix/shmem.c,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- shmem.c	2001/08/20 18:43:20	1.30
  +++ shmem.c	2001/08/30 02:30:48	1.31
  @@ -248,7 +248,8 @@
   APR_DECLARE(void *) apr_shm_calloc(apr_shmem_t *m, apr_size_t reqsize) 
   {
       void *new = apr_shm_malloc(m, reqsize);
  -    memset(new, '\0', reqsize);
  +    if (new)
  +        memset(new, '\0', reqsize);
       return new;
   }
   
  
  
  

Mime
View raw message