From 736491d1558dc97be4b8fac8957f3b5c7c0254f6 Mon Sep 17 00:00:00 2001 From: Matthew Daley Date: Wed, 18 Sep 2013 15:37:41 +1200 Subject: libxl: fix dispose without init of disk in cd_insert Coverity-ID: 1056078 Signed-off-by: Matthew Daley Acked-by: Ian Campbell --- tools/libxl/xl_cmdimpl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'tools') diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c index 3d7eaad5e0..a609b98b0f 100644 --- a/tools/libxl/xl_cmdimpl.c +++ b/tools/libxl/xl_cmdimpl.c @@ -2529,18 +2529,16 @@ int main_memset(int argc, char **argv) static int cd_insert(uint32_t domid, const char *virtdev, char *phys) { - libxl_device_disk disk; /* we don't free disk's contents */ + libxl_device_disk disk; char *buf = NULL; XLU_Config *config = 0; struct stat b; int rc = 0; - if (asprintf(&buf, "vdev=%s,access=r,devtype=cdrom,target=%s", virtdev, phys ? phys : "") < 0) { fprintf(stderr, "out of memory\n"); - rc = 1; - goto out; + return 1; } parse_disk_config(&config, buf, &disk); -- cgit v1.2.3