From: "Jan Beulich" Subject: Re: [PATCH v2 1/3] xc/tmem: Free temporary buffer used during migration Date: Wed, 07 May 2014 09:26:53 +0100 Message-ID: <536A0A6D020000780000FBC1@mail.emea.novell.com> References: <1399444250-17529-1-git-send-email-bob.liu@oracle.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WhxBo-0000uF-T8 for xen-devel@lists.xenproject.org; Wed, 07 May 2014 08:26:56 +0000 In-Reply-To: <1399444250-17529-1-git-send-email-bob.liu@oracle.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Bob Liu Cc: andrew.cooper3@citrix.com, keir@xen.org, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org >>> On 07.05.14 at 08:30, wrote: > From: Konrad Rzeszutek Wilk > > CID 1090388. > > Within the loop reading the pool_id we set the buf: > > if ( (buf = realloc(buf,bufsize)) == NULL ) > > and then continue on using it without freeing. Worst yet > there are multiple 'if (..) return -1' which do not free > the buffer. > > As such insert a 'fail' goto label to free the buffer > and also add on the OK path a mechanism to free the buffer. > > Replace all of the 'return -1' with a jump to the failed > label. > > v2: > * Remove superfluous braces. (Andrew) > > Signed-off-by: Konrad Rzeszutek Wilk > Signed-off-by: Bob Liu > Reviewed-by: Andrew Cooper > --- > tools/libxc/xc_tmem.c | 44 ++++++++++++++++++++++++++------------------ > 1 file changed, 26 insertions(+), 18 deletions(-) For this and the second patch you ought to Cc the tools maintainers instead of the hypervisor ones, and for the third patch Cc-ing the tmem maintainer would be sufficient. Jan