mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
tools/libxl: close the logfile_w and null file descriptors in libxl__spawn_qdisk_backend() error path
Signed-off-by: Koushik Chakravarty <koushik.chakravarty@citrix.com> CC: Ian Jackson <ian.jackson@eu.citrix.com> CC: Stefano Stabellini <stefano.stabellini@eu.citrix.com> CC: Ian Campbell <ian.campbell@citrix.com> CC: Wei Liu <wei.liu2@citrix.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
1 parent
cb85ac536e
commit
eb84b068f9
1 file changed
+7
-1
@@ -1527,7 +1527,7 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss)
|
||||
flexarray_t *dm_args;
|
||||
char **args;
|
||||
const char *dm;
|
||||
int logfile_w, null, rc;
|
||||
int logfile_w, null = -1, rc;
|
||||
uint32_t domid = dmss->guest_domid;
|
||||
|
||||
/* Always use qemu-xen as device model */
|
||||
@@ -1553,6 +1553,10 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss)
|
||||
goto error;
|
||||
}
|
||||
null = open("/dev/null", O_RDONLY);
|
||||
if (null < 0) {
|
||||
rc = ERROR_FAIL;
|
||||
goto error;
|
||||
}
|
||||
|
||||
dmss->guest_config = NULL;
|
||||
/*
|
||||
@@ -1587,6 +1591,8 @@ void libxl__spawn_qdisk_backend(libxl__egc *egc, libxl__dm_spawn_state *dmss)
|
||||
|
||||
error:
|
||||
assert(rc);
|
||||
if (logfile_w >= 0) close(logfile_w);
|
||||
if (null >= 0) close(null);
|
||||
dmss->callback(egc, dmss, rc);
|
||||
return;
|
||||
}
|
||||
|
||||