From owner-svn-src-head@FreeBSD.ORG Mon Apr 14 21:02:20 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 970123E7; Mon, 14 Apr 2014 21:02:20 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::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 83EB01B9A; Mon, 14 Apr 2014 21:02:20 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3EL2KM5037908; Mon, 14 Apr 2014 21:02:20 GMT (envelope-from brueffer@svn.freebsd.org) Received: (from brueffer@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3EL2KMp037907; Mon, 14 Apr 2014 21:02:20 GMT (envelope-from brueffer@svn.freebsd.org) Message-Id: <201404142102.s3EL2KMp037907@svn.freebsd.org> From: Christian Brueffer Date: Mon, 14 Apr 2014 21:02:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264471 - head/sys/kern X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Apr 2014 21:02:20 -0000 Author: brueffer Date: Mon Apr 14 21:02:20 2014 New Revision: 264471 URL: http://svnweb.freebsd.org/changeset/base/264471 Log: Refine r264422: set buf to NULL only when we don't allocate memory, and free buf unconditionally. Requested by: kib MFC after: 1 week Modified: head/sys/kern/imgact_elf.c Modified: head/sys/kern/imgact_elf.c ============================================================================== --- head/sys/kern/imgact_elf.c Mon Apr 14 20:51:04 2014 (r264470) +++ head/sys/kern/imgact_elf.c Mon Apr 14 21:02:20 2014 (r264471) @@ -1740,16 +1740,16 @@ __elfN(note_threadmd)(void *arg, struct td = (struct thread *)arg; size = *sizep; - buf = NULL; if (size != 0 && sb != NULL) buf = malloc(size, M_TEMP, M_ZERO | M_WAITOK); + else + buf = NULL; size = 0; __elfN(dump_thread)(td, buf, &size); KASSERT(*sizep == size, ("invalid size")); - if (size != 0 && sb != NULL) { + if (size != 0 && sb != NULL) sbuf_bcat(sb, buf, size); - free(buf, M_TEMP); - } + free(buf, M_TEMP); *sizep = size; }