tools/xcutils: xc_save: avoid allocing local constant string

cmd_str doesn't need to be allocated.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
This commit is contained in:
Lai Jiangshan authored and Ian Jackson committed 2014-03-13 16:53:44 +00:00
1 parent 83e26b9c41
commit 811006b4ce
1 file changed
+1 -3
+1 -3
View File
@@ -127,8 +127,7 @@ static int switch_qemu_logdirty(int domid, unsigned int enable, void *data)
if (!xs_watch(xs, path, "qemu-logdirty-ret"))
errx(1, "can't set watch in store (%s)\n", path);
if (!(cmd_str = strdup( enable == 0 ? "disable" : "enable")))
errx(1, "can't get logdirty cmd path in store");
cmd_str = enable == 0 ? "disable" : "enable";
/* Tell qemu that we want it to start logging dirty page to Xen */
strcpy(p, "cmd");
@@ -156,7 +155,6 @@ static int switch_qemu_logdirty(int domid, unsigned int enable, void *data)
goto read_again;
free(path);
free(cmd_str);
free(ret_str);
return 0;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.