From owner-svn-src-head@FreeBSD.ORG Fri Jan 24 00:24:32 2014 Return-Path: Delivered-To: svn-src-head@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id D519FC04; Fri, 24 Jan 2014 00:24:32 +0000 (UTC) Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AD4AD1E0F; Fri, 24 Jan 2014 00:24:32 +0000 (UTC) Received: from h2.funkthat.com (localhost [127.0.0.1]) by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id s0O0OPVm086936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 23 Jan 2014 16:24:26 -0800 (PST) (envelope-from jmg@h2.funkthat.com) Received: (from jmg@localhost) by h2.funkthat.com (8.14.3/8.14.3/Submit) id s0O0OPr7086935; Thu, 23 Jan 2014 16:24:25 -0800 (PST) (envelope-from jmg) Date: Thu, 23 Jan 2014 16:24:25 -0800 From: John-Mark Gurney To: Mateusz Guzik Subject: Re: svn commit: r261085 - head/sys/geom Message-ID: <20140124002425.GB75135@funkthat.com> References: <201401231931.s0NJVHKS089308@svn.freebsd.org> <20140123201748.GA26772@dft-labs.eu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140123201748.GA26772@dft-labs.eu> User-Agent: Mutt/1.4.2.3i X-Operating-System: FreeBSD 7.2-RELEASE i386 X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88 9322 9CB1 8F74 6D3F A396 X-Files: The truth is out there X-URL: http://resnet.uoregon.edu/~gurney_j/ X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger? X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2 (h2.funkthat.com [127.0.0.1]); Thu, 23 Jan 2014 16:24:26 -0800 (PST) Cc: svn-src-head@FreeBSD.org, "Andrey V. Elsukov" , svn-src-all@FreeBSD.org, src-committers@FreeBSD.org 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: Fri, 24 Jan 2014 00:24:32 -0000 Mateusz Guzik wrote this message on Thu, Jan 23, 2014 at 21:17 +0100: > On Thu, Jan 23, 2014 at 07:31:17PM +0000, Andrey V. Elsukov wrote: > > @@ -122,7 +123,7 @@ geom_alloc_copyin(struct gctl_req *req, > > void *ptr; > > > > ptr = g_malloc(len, M_WAITOK); > > - nreq->nerror = copyin(uaddr, ptr, len); > > + req->nerror = copyin(uaddr, ptr, len); > > if (!req->nerror) > > return (ptr); > > if (ptr != NULL) > > Is not this if (ptr != NULL) unnecesary? The code: if (!req->nerror) return (ptr); if (ptr != NULL) g_free(ptr); return (NULL); If anything, the if statement can be removed, but the g_free needs to remain, otherwise there will be a memory leak... -- John-Mark Gurney Voice: +1 415 225 5579 "All that I will do, has been done, All that I have, has not."