Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Oct 2010 16:00:45 +0000 (UTC)
From:      Matthew D Fleming <mdf@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r214207 - in stable/7: share/man/man9 sys/vm
Message-ID:  <201010221600.o9MG0jD4059183@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mdf
Date: Fri Oct 22 16:00:45 2010
New Revision: 214207
URL: http://svn.freebsd.org/changeset/base/214207

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

Modified:
  stable/7/share/man/man9/zone.9
  stable/7/sys/vm/uma_core.c
Directory Properties:
  stable/7/share/man/man9/   (props changed)
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/share/man/man9/zone.9
==============================================================================
--- stable/7/share/man/man9/zone.9	Fri Oct 22 16:00:00 2010	(r214206)
+++ stable/7/share/man/man9/zone.9	Fri Oct 22 16:00:45 2010	(r214207)
@@ -147,6 +147,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: stable/7/sys/vm/uma_core.c
==============================================================================
--- stable/7/sys/vm/uma_core.c	Fri Oct 22 16:00:00 2010	(r214206)
+++ stable/7/sys/vm/uma_core.c	Fri Oct 22 16:00:45 2010	(r214207)
@@ -2250,6 +2250,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, keg->uk_size, udata);
 #ifdef INVARIANTS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201010221600.o9MG0jD4059183>