From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53386) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfSqC-0001v4-BQ for qemu-devel@nongnu.org; Fri, 25 Sep 2015 09:15:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfSq8-0006kf-BN for qemu-devel@nongnu.org; Fri, 25 Sep 2015 09:15:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfSq8-0006ik-3r for qemu-devel@nongnu.org; Fri, 25 Sep 2015 09:15:04 -0400 Message-ID: <1443186899.1789.4.camel@redhat.com> From: Gerd Hoffmann Date: Fri, 25 Sep 2015 15:14:59 +0200 In-Reply-To: <20150924131554-mutt-send-email-mst@redhat.com> References: <1443085502-596-1-git-send-email-kraxel@redhat.com> <1443085502-596-5-git-send-email-kraxel@redhat.com> <20150924131554-mutt-send-email-mst@redhat.com> Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH v2 04/11] virtio-gpu: move iov free to virtio_gpu_cleanup_mapping_iov List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: David Airlie , =?ISO-8859-1?Q?Marc-Andr=E9?= Lureau , qemu-devel@nongnu.org, Max Reitz On Do, 2015-09-24 at 13:16 +0300, Michael S. Tsirkin wrote: > On Thu, Sep 24, 2015 at 11:04:55AM +0200, Gerd Hoffmann wrote: > > Signed-off-by: Gerd Hoffmann > > It's easy to see this is what the patch does. But why? Some > explanation in the commit log about why it's done, as opposed to what is > done, would be better. It's for symmetry reasons: virtio_gpu_create_mapping_iov() allocates it so virtio_gpu_cleanup_mapping_iov() should free it, otherwise it's easy to miss a free() needed and leak memory. cheers, Gerd