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

[Xen-changelog] [xen master] tools/xcutils: xc_save: avoid allocing local constant string



commit 811006b4cef2bfa890676b41bd90f40a64f40bf7
Author:     Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
AuthorDate: Tue Mar 11 22:15:24 2014 +0800
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Thu Mar 13 16:53:44 2014 +0000

    tools/xcutils: xc_save: avoid allocing local constant string
    
    cmd_str doesn't need to be allocated.
    
    Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 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 ecf5444..654c9c2 100644
--- a/tools/xcutils/xc_save.c
+++ b/tools/xcutils/xc_save.c
@@ -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;
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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