xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Chun Yan Liu" <cyliu@suse.com>
To: Ian Jackson <Ian.Jackson@eu.citrix.com>, xen-devel@lists.xensource.com
Cc: coverity@xenproject.org
Subject: Re: [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents
Date: Thu, 07 Apr 2016 02:16:14 -0600	[thread overview]
Message-ID: <570687CE02000066000C6578@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1459782600-16073-2-git-send-email-ian.jackson@eu.citrix.com>



>>> On 4/4/2016 at 11:10 PM, in message
<1459782600-16073-2-git-send-email-ian.jackson@eu.citrix.com>, Ian Jackson
<ian.jackson@eu.citrix.com> wrote: 
> Bug introduced in bc023ecd 
> "libxl_utils: add internal function to read sysfs file contents" 
>  
> CID: 1358108 
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com> 
> CC: coverity@xenproject.org 
> CC: Chunyan Liu <cyliu@suse.com> 
> --- 
>  tools/libxl/libxl_utils.c |    1 + 
>  1 file changed, 1 insertion(+) 
>  
> diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c 
> index ceb8825..bd58a52 100644 
> --- a/tools/libxl/libxl_utils.c 
> +++ b/tools/libxl/libxl_utils.c 
> @@ -466,6 +466,7 @@ int libxl__read_sysfs_file_contents(libxl__gc *gc, const  
> char *filename, 
>      e = errno; 
>      assert(e != ENOENT); 
>      if (f) fclose(f); 
> +    free(data); 

'data' is malloced with 'gc', it'll be freed by GC_FREE. Do we need to free
it here?

Chunyan

>      return e; 
>  } 
>   
 



_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-04-07  8:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-04 15:09 [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Ian Jackson
2016-04-04 15:10 ` [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents Ian Jackson
2016-04-07  8:16   ` Chun Yan Liu [this message]
2016-04-07 17:03     ` Ian Jackson
2016-04-07  8:17 ` [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Chun Yan Liu
2016-04-07 17:04   ` Ian Jackson
2016-04-08  3:48     ` Chun Yan Liu
2016-04-08 13:34       ` Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=570687CE02000066000C6578@prv-mh.provo.novell.com \
    --to=cyliu@suse.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=coverity@xenproject.org \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).