xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: ian.jackson@eu.citrix.com, wei.liu2@citrix.com, xen-devel@lists.xen.org
Cc: Ian Campbell <ian.campbell@citrix.com>
Subject: [PATCH] xenpaging: do not leak if --pagefile given twice
Date: Wed, 17 Feb 2016 14:58:33 +0000	[thread overview]
Message-ID: <1455721113-11540-1-git-send-email-ian.campbell@citrix.com> (raw)

By freeing filename (which is either NULL or the previous iteration of
this argument). This implements a semantic where the last --pagefile
given on the command line takes precedence.

This is the same semantic as the other options have.

CID: 1198792

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/xenpaging/xenpaging.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/xenpaging/xenpaging.c b/tools/xenpaging/xenpaging.c
index 0377507..6157d3a 100644
--- a/tools/xenpaging/xenpaging.c
+++ b/tools/xenpaging/xenpaging.c
@@ -232,6 +232,7 @@ static int xenpaging_getopts(struct xenpaging *paging, int argc, char *argv[])
             paging->vm_event.domain_id = atoi(optarg);
             break;
         case 'f':
+            free(filename);
             filename = strdup(optarg);
             break;
         case 'm':
-- 
2.1.4

             reply	other threads:[~2016-02-17 14:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-17 14:58 Ian Campbell [this message]
2016-02-17 19:14 ` [PATCH] xenpaging: do not leak if --pagefile given twice Konrad Rzeszutek Wilk
2016-02-17 19:23   ` Konrad Rzeszutek Wilk

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=1455721113-11540-1-git-send-email-ian.campbell@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /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).