From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aIT1x-0004Cp-VF for qemu-devel@nongnu.org; Sun, 10 Jan 2016 22:20:30 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aIT1x-0003OO-37 for qemu-devel@nongnu.org; Sun, 10 Jan 2016 22:20:29 -0500 Date: Mon, 11 Jan 2016 11:20:18 +0800 From: Fam Zheng Message-ID: <20160111032018.GA24392@ad.usersys.redhat.com> References: <1451454566-15005-1-git-send-email-famz@redhat.com> <1451454566-15005-2-git-send-email-famz@redhat.com> <20160108162428.GC24031@redhat.com> <568FFEE9.9040303@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <568FFEE9.9040303@redhat.com> Subject: Re: [Qemu-devel] [PATCH 1/2] nbd: Interface tweak of nbd_client_new List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Kevin Wolf , qemu-devel@nongnu.org, qemu-block@nongnu.org On Fri, 01/08 19:24, Paolo Bonzini wrote: > > > On 08/01/2016 17:24, Daniel P. Berrange wrote: > >> > if (nbd_send_negotiate(client)) { > >> > + shutdown(csock, 2); > >> > + close(csock); > >> > g_free(client); > >> > - return NULL; > >> > + ret = -1; > >> > + goto out; > > If you simply make this failure code branch call close_fn() then I > > think you can adding needing the new NBDClientNewCB entirely if.... > > Good idea, but note that close_fn will call nbd_client_put, so the > close/g_free must be removed. It's probably cleanest to change csock to > client->sock in the shutdown call, too. Good suggestions, will update and resend. Thanks! Fam