]> xenbits.xensource.com Git - xen.git/commitdiff
xenpaging: do not leak if --pagefile given twice
authorIan Campbell <ian.campbell@citrix.com>
Wed, 17 Feb 2016 14:58:33 +0000 (14:58 +0000)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 17 Feb 2016 19:22:24 +0000 (14:22 -0500)
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

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
tools/xenpaging/xenpaging.c

index 0377507e115e812822a2ec09bf736e78733e674e..6157d3a4b65792b390e25aeb9bb3079bbe298c39 100644 (file)
@@ -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':