Skip to contentSkip to conversation

xenpaging: do not leak if --pagefile given twice

PATCH In review Ian Campbell 2 participants 3 messages Feb 17, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xenpaging: do not leak if --pagefile given twice

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

---
 tools/xenpaging/xenpaging.c | 1 +
 1 file changed, 1 insertion(+)
tools/xenpaging/xenpaging.c +1 -0
index 0377507..6157d3a 100644
@@ -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':
Signature · 1 line
2.1.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Ian Campbell

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

Quoted 25 lines
---
 tools/xenpaging/xenpaging.c | 1 +
 1 file changed, 1 insertion(+)
tools/xenpaging/xenpaging.c +1 -0
index 0377507..6157d3a 100644
@@ -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':
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
#2 lore raw
Quoted 11 lines · Konrad Rzeszutek Wilk
Quoted 8 lines · Ian Campbell

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

and applied. Figured nobody would mind this fix.

Quoted 26 lines
Quoted 26 lines
---
 tools/xenpaging/xenpaging.c | 1 +
 1 file changed, 1 insertion(+)
tools/xenpaging/xenpaging.c +1 -0
index 0377507..6157d3a 100644
@@ -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':
Signature · 7 lines
2.1.4


_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel