[Spread-cvs] cvs commit: spread/daemon Readme.txt groups.c skiplist.c skiplist.h

jonathan at spread.org jonathan at spread.org
Fri Apr 16 12:50:34 EDT 2004


jonathan    04/04/16 12:50:34

  Modified:    daemon   Readme.txt groups.c skiplist.c skiplist.h
  Log:
  Fix for memory leak in way groups was using skiplists. The MembersList skl
  in the group struct was not being freed. Reported by Taj Khattra, patch by
  Theo Schlossnagle.
  
  Revision  Changes    Path
  1.53      +6 -35     spread/daemon/Readme.txt
  
  Index: Readme.txt
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/Readme.txt,v
  retrieving revision 1.52
  retrieving revision 1.53
  diff -u -r1.52 -r1.53
  --- Readme.txt	14 Apr 2004 19:20:45 -0000	1.52
  +++ Readme.txt	16 Apr 2004 16:50:34 -0000	1.53
  @@ -49,41 +49,12 @@
   | Version 3.17.2 Built 5/March/2004                                         |
   \===========================================================================/
   
  -March 5, 2004 Ver 3.17.2:
  ---------------
  -1) Fix daemon quit when multiple interfaces are configured as "D" daemon 
  -   interfaces in the spread.conf file. Bug reported by Orit Wasserman.
  -2) Updated url for Java 'ant' build system. Patch by Daniel Rall.
  -3) Fix group_id bug that causes incorrect vs_sets. Patch by Ryan Caudy.
  -4) Fix spread.conf parser so it validates the machine names in segments
  -   and forces them to be less then MAX_PROC_NAME. Patch by Mikhail Terekhov.
  -5) Minor fix to Mac OS X compilation so library softlinks do not fail the 
  -   second time make is run.
  -6) Alarm() changes to support priority levels on each Alarm() call. 
  -7) Fix crash by improving packet accounting when a client connected to a 
  -   singleton daemon sends a large broadcast. Reported by David Shaw.
  -8) Fix bus errors on Sparc & Alpha for message buffer integer assignment. 
  -   Reported by Greg Shebert; tested and patched Mikhail Terekhov.
  -9) Verify daemon names in spread.conf are unique. If non-unique names are
  -   provided in spread.conf, configuration will be rejected and daemon will 
  -   not start. Suggested by Tim Peters. 
  -10) Zero buffer in c library before sending multicast. 
  -    Reported by Panagiotis Kougiouris. 
  -11) Send fewer lookup probe messages when only a single segment is configured.
  -12) Remove extra token rotations when no messages are sent. Will decrease
  -    network packet overhead. 
  -13) Make mailbox and service in sp.h a typedef instead of a #define. Suggested
  -    and patched by Steven Dake. 
  -14) Fix small endianness error in sp.c where the mess_type field may not be
  -    correctly converted for different endian platforms when the SP_*_recv calls
  -    return a BUFFER_TOO_SHORT or GROUPS_TOO_SHORT error.
  -15) Change alarm tag for security prints from SEC to SECURITY because of conflict
  -    with sys/time.h header.
  -16) Documentation fix to SP_receive man page to correct fields for self-leave
  -    membership messages.
  -17) Update of email addresses in copyright statements and headers.
  -18) Windows binary libraries now built as libspread and libtspread like other
  -    platforms. 
  +XXX, 2004 Ver 3.17.X
  +--------------------
  +
  +1) Fix memory leak in Skiplist. Reported by Taj Khattra, patch by Theo 
  +   Schlossnagle.
  +
   
   SOURCE INSTALL:
   ---------------
  
  
  
  1.16      +7 -1      spread/daemon/groups.c
  
  Index: groups.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/groups.c,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- groups.c	5 Mar 2004 00:32:46 -0000	1.15
  +++ groups.c	16 Apr 2004 16:50:34 -0000	1.16
  @@ -341,6 +341,7 @@
                               if( grp->num_members == 0 )
   			    {
   				/* discard this empty group */
  +                                sl_destruct ( &grp->MembersList, dispose);
                                   sl_remove (  &GroupsList, grp->name, dispose);
   				Num_groups--;
   				GlobalStatus.num_groups = Num_groups;
  @@ -417,6 +418,7 @@
   			    if( grp->num_members == 0 )
   			    {
   				/* discard this empty group */
  +                                sl_destruct ( &grp->MembersList, dispose);
                                   sl_remove (  &GroupsList, grp->name, dispose);
   				Num_groups--;
   				GlobalStatus.num_groups = Num_groups;
  @@ -658,6 +660,7 @@
   			if( grp->num_members == 0 )
   			{
   				/* discard this empty group */
  +                                sl_destruct ( &grp->MembersList, dispose);
   				sl_remove ( &GroupsList, grp->name, dispose);
   				Num_groups--;
   				GlobalStatus.num_groups = Num_groups;
  @@ -1117,6 +1120,7 @@
   		if( grp->num_members == 0 )
   		{
   			/* discard this empty group */
  +                        sl_destruct ( &grp->MembersList, dispose);
   		        sl_remove( &GroupsList, grp->name, dispose );
   			Num_groups--;
   			GlobalStatus.num_groups = Num_groups;
  @@ -1286,6 +1290,7 @@
   			grp->num_members--;
   			if( grp->num_members == 0 )
   			{
  +                                sl_destruct ( &grp->MembersList, dispose);
                                   sl_remove( &GroupsList, grp->name, dispose );
   				Num_groups--;
   				GlobalStatus.num_groups = Num_groups;
  @@ -1611,6 +1616,7 @@
   		  orig_grp->num_members = orig_grp->MembersList.size;
   
   			/* free this Work group */
  +                  sl_destruct(&currentgroup->MembersList, dispose);
   		  sl_remove(indices[i]->groups, currentgroup, dispose);
               }
   
  @@ -1692,7 +1698,7 @@
   		}       
   	}       
           
  -	sl_remove_all( &work, dispose );        
  +        sl_destruct( &work, dispose );
           
   	G_print();
   }
  
  
  
  1.5       +12 -0     spread/daemon/skiplist.c
  
  Index: skiplist.c
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/skiplist.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- skiplist.c	5 Mar 2004 00:32:46 -0000	1.4
  +++ skiplist.c	16 Apr 2004 16:50:34 -0000	1.5
  @@ -555,3 +555,15 @@
     sl->height = 0;
     sl->size = 0;
   }
  +void sli_destruct_free(Skiplist *sl, FreeFunc myfree) {
  +  sl_remove_all(sl, NULL);
  +  free(sl);
  +}
  +void sl_destruct(Skiplist *sl, FreeFunc myfree) {
  +  if(sl->index) {
  +    sl_remove_all(sl->index, (FreeFunc)sli_destruct_free);
  +    free(sl->index);
  +  }
  +  sl_remove_all(sl, myfree);
  +}
  +
  
  
  
  1.4       +6 -2      spread/daemon/skiplist.h
  
  Index: skiplist.h
  ===================================================================
  RCS file: /storage/cvsroot/spread/daemon/skiplist.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- skiplist.h	5 Mar 2004 00:32:46 -0000	1.3
  +++ skiplist.h	16 Apr 2004 16:50:34 -0000	1.4
  @@ -110,10 +110,14 @@
   int sl_remove_compare(Skiplist *sl, void *data, FreeFunc myfree,
   		      SkiplistComparator comp);
   
  -/* removes all nodes in a skiplist, you can free the skiplist itself
  -   without memory leaks after calling this function */
  +/* removes all nodes in a skiplist, the list can still be used */
   /* sl is the skiplist from which you are removing */
   void sl_remove_all(Skiplist *sl, FreeFunc myfree);
  +
  +/* removes all nodes in a skiplist, you can free the skiplist itself
  +   without memory leaks after calling this function.  After calling
  +   this function, the list cannot be safely used, it must be freed */
  +void sl_destruct(Skiplist *sl, FreeFunc myfree);
   
   
   #endif
  
  
  




More information about the Spread-cvs mailing list