Author: mdf
Date: Tue Oct 19 16:06:00 2010
New Revision: 214062
URL: http://svn.freebsd.org/changeset/base/214062

Log:
  uma_zfree(zone, NULL) should do nothing, to match free(9).
  
  Noticed by:   Ron Steinke <rsteinke at isilon dot com>
  MFC after:    3 days

Modified:
  head/share/man/man9/zone.9
  head/sys/vm/uma_core.c

Modified: head/share/man/man9/zone.9
==============================================================================
--- head/share/man/man9/zone.9  Tue Oct 19 15:26:08 2010        (r214061)
+++ head/share/man/man9/zone.9  Tue Oct 19 16:06:00 2010        (r214062)
@@ -153,6 +153,13 @@ Items are released back to the zone from
 calling
 .Fn uma_zfree
 with a pointer to the zone and a pointer to the item.
+If
+.Fa item
+is
+.Dv NULL ,
+then
+.Fn uma_zfree
+does nothing.
 .Pp
 The variations
 .Fn uma_zalloc_arg

Modified: head/sys/vm/uma_core.c
==============================================================================
--- head/sys/vm/uma_core.c      Tue Oct 19 15:26:08 2010        (r214061)
+++ head/sys/vm/uma_core.c      Tue Oct 19 16:06:00 2010        (r214062)
@@ -2517,6 +2517,10 @@ uma_zfree_arg(uma_zone_t zone, void *ite
        CTR2(KTR_UMA, "uma_zfree_arg thread %x zone %s", curthread,
            zone->uz_name);
 
+        /* uma_zfree(..., NULL) does nothing, to match free(9). */
+        if (item == NULL)
+                return;
+
        if (zone->uz_dtor)
                zone->uz_dtor(item, zone->uz_size, udata);
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to