[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 4/5] xc_save: avoid to alloc local constant string



cmd_str will only cleanup by other place,
it don't need to be allocated.

Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
---
 tools/xcutils/xc_save.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/tools/xcutils/xc_save.c b/tools/xcutils/xc_save.c
index e34bd2c..1304433 100644
--- a/tools/xcutils/xc_save.c
+++ b/tools/xcutils/xc_save.c
@@ -128,8 +128,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");
@@ -157,7 +156,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;
-- 
1.7.1


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.