From owner-svn-src-all@freebsd.org Tue Jan 26 05:04:38 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EF39A46194; Tue, 26 Jan 2016 05:04:38 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2B931D37; Tue, 26 Jan 2016 05:04:37 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0Q54bNP080167; Tue, 26 Jan 2016 05:04:37 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0Q54bHe080166; Tue, 26 Jan 2016 05:04:37 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201601260504.u0Q54bHe080166@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Tue, 26 Jan 2016 05:04:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r294763 - stable/9/lib/libc/stdlib X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2016 05:04:38 -0000 Author: pfg Date: Tue Jan 26 05:04:36 2016 New Revision: 294763 URL: https://svnweb.freebsd.org/changeset/base/294763 Log: Revert r279011: tdelete(3): don't delete the node we are about to return. The original change, from NetBSD, was bogus; introduced a memory leak and and broke POSIX. By reverting we actually match NetBSD's latest revision. This is a revert of the original merge: this function was rewritten in 11-current. Reported by: Markiyan Kushnir Obtained from: NetBSD (CVS rev. 1.7, 1.8) Modified: stable/9/lib/libc/stdlib/tdelete.c Directory Properties: stable/9/lib/libc/ (props changed) Modified: stable/9/lib/libc/stdlib/tdelete.c ============================================================================== --- stable/9/lib/libc/stdlib/tdelete.c Tue Jan 26 04:51:44 2016 (r294762) +++ stable/9/lib/libc/stdlib/tdelete.c Tue Jan 26 05:04:36 2016 (r294763) @@ -14,7 +14,7 @@ #include #if 0 #if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: tdelete.c,v 1.6 2012/06/25 22:32:45 abs Exp $"); +__RCSID("$NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $"); #endif /* LIBC_SCCS and not lint */ #endif __FBSDID("$FreeBSD$"); @@ -25,9 +25,9 @@ __FBSDID("$FreeBSD$"); /* - * find a node with given key + * delete node with given key * - * vkey: key to be found + * vkey: key to be deleted * vrootp: address of the root of the tree * compar: function to carry out node comparisons */ @@ -65,8 +65,7 @@ tdelete(const void * __restrict vkey, vo q->rlink = (*rootp)->rlink; } } - if (p != *rootp) - free(*rootp); /* D4: Free node */ + free(*rootp); /* D4: Free node */ *rootp = q; /* link parent to new node */ return p; }