apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: apr/memory/unix apr_sms.c
Date Mon, 18 Jun 2001 20:14:40 GMT
dreid       01/06/18 13:14:39

  Modified:    memory/unix apr_sms.c
  Log:
  Change some of the logic so we don't segfault if no parent.
  Change to use pms as it's been set to sms->parent and it's clearer.
  
  Submitted by:	Sander Striker <striker@samba-tng.org>
  Reviewed by:	David Reid <dreid@apache.org>
  
  Revision  Changes    Path
  1.24      +12 -13    apr/memory/unix/apr_sms.c
  
  Index: apr_sms.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_sms.c,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- apr_sms.c	2001/06/17 21:11:58	1.23
  +++ apr_sms.c	2001/06/18 20:14:36	1.24
  @@ -467,18 +467,17 @@
       pms = sms->parent;
       
       /* Remove the memory system from the parent memory systems child list */
  -    if (pms->sms_lock)
  -        apr_lock_acquire(pms->sms_lock);
  +    if (pms) {
  +        if (pms->sms_lock)
  +            apr_lock_acquire(pms->sms_lock);
           
  -    if (sms->sibling)
  -        sms->sibling->ref = sms->ref;
  +        if ((*sms->ref = sms->sibling) != NULL)
  +            sms->sibling->ref = sms->ref;
   
  -    if (sms->ref)
  -        *sms->ref = sms->sibling;
  -
  -    if (pms->sms_lock)
  -        apr_lock_release(pms->sms_lock);
  -        
  +        if (pms->sms_lock)
  +            apr_lock_release(pms->sms_lock);
  +    }
  +    
       /* Call the pre-destroy if present */
       if (sms->pre_destroy_fn)
           sms->pre_destroy_fn(sms);
  @@ -494,16 +493,16 @@
           return sms->destroy_fn(sms);
   
       /* 2 - If we don't have a parent, free using ourselves */
  -    if (!sms->parent)
  +    if (!pms)
           return sms->free_fn(sms, sms);
   
       /* 3 - If we do have a parent and it has a free function, use it */
  -    if (sms->parent->free_fn)
  +    if (pms->free_fn)
           return apr_sms_free(sms->parent, sms);
   
       /* 4 - Assume we are the child of a tracking memory system, do nothing */
   #ifdef APR_ASSERT_MEMORY
  -    sms = sms->parent;
  +    sms = pms;
       while (sms) {
           if (apr_sms_is_tracking(sms))
               return APR_SUCCESS;
  
  
  

Mime
View raw message