Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 17 Sep 2019 18:36:30 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352456 - head/contrib/jemalloc/src
Message-ID:  <201909171836.x8HIaUhL050110@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Tue Sep 17 18:36:29 2019
New Revision: 352456
URL: https://svnweb.freebsd.org/changeset/base/352456

Log:
  realloc(x, 0) should not return NULL.
  
  See http://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400.
  Upstream jemalloc issue is opened by emaste at
  https://github.com/jemalloc/jemalloc/issues/1629.
  
  Reviewed by:	emaste
  PR:	240456
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week
  DIfferential revision:	https://reviews.freebsd.org/D21632

Modified:
  head/contrib/jemalloc/src/jemalloc.c

Modified: head/contrib/jemalloc/src/jemalloc.c
==============================================================================
--- head/contrib/jemalloc/src/jemalloc.c	Tue Sep 17 18:32:18 2019	(r352455)
+++ head/contrib/jemalloc/src/jemalloc.c	Tue Sep 17 18:36:29 2019	(r352456)
@@ -2299,21 +2299,6 @@ je_realloc(void *ptr, size_t size) {
 	LOG("core.realloc.entry", "ptr: %p, size: %zu\n", ptr, size);
 
 	if (unlikely(size == 0)) {
-		if (ptr != NULL) {
-			/* realloc(ptr, 0) is equivalent to free(ptr). */
-			UTRACE(ptr, 0, 0);
-			tcache_t *tcache;
-			tsd_t *tsd = tsd_fetch();
-			if (tsd_reentrancy_level_get(tsd) == 0) {
-				tcache = tcache_get(tsd);
-			} else {
-				tcache = NULL;
-			}
-			ifree(tsd, ptr, tcache, true);
-
-			LOG("core.realloc.exit", "result: %p", NULL);
-			return NULL;
-		}
 		size = 1;
 	}
 



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