From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49008) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WELVk-0002VN-Vn for qemu-devel@nongnu.org; Fri, 14 Feb 2014 11:21:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WELVW-0007Gt-IG for qemu-devel@nongnu.org; Fri, 14 Feb 2014 11:21:08 -0500 Received: from mail-wi0-x233.google.com ([2a00:1450:400c:c05::233]:38502) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WELVW-0007GQ-CI for qemu-devel@nongnu.org; Fri, 14 Feb 2014 11:20:54 -0500 Received: by mail-wi0-f179.google.com with SMTP id hn9so635729wib.0 for ; Fri, 14 Feb 2014 08:20:53 -0800 (PST) Date: Fri, 14 Feb 2014 17:20:50 +0100 From: Stefan Hajnoczi Message-ID: <20140214162050.GF23572@stefanha-thinkpad.redhat.com> References: <1392138233-26407-1-git-send-email-pbonzini@redhat.com> <1392138233-26407-7-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1392138233-26407-7-git-send-email-pbonzini@redhat.com> Subject: Re: [Qemu-devel] [PATCH v2 06/20] iscsi: correctly propagate errors in iscsi_open List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: kwolf@redhat.com, famz@redhat.com, qemu-devel@nongnu.org On Tue, Feb 11, 2014 at 06:03:39PM +0100, Paolo Bonzini wrote: > @@ -1349,14 +1350,15 @@ static int iscsi_reopen_prepare(BDRVReopenState *state, > static int iscsi_truncate(BlockDriverState *bs, int64_t offset) > { > IscsiLun *iscsilun = bs->opaque; > - int ret = 0; > + Error *local_err = NULL; > > if (iscsilun->type != TYPE_DISK) { > return -ENOTSUP; > } > > - if ((ret = iscsi_readcapacity_sync(iscsilun)) != 0) { > - return ret; > + iscsi_readcapacity_sync(iscsilun, &local_err); > + if (local_err != NULL) { > + return -EIO; > } Memory leak. We need to free local_err.