qemu-trivial
[Top][All Lists]
Advanced

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

Re: [Qemu-trivial] [PATCH] qemu-ga: remove useless allocation


From: Philippe Mathieu-Daudé
Subject: Re: [Qemu-trivial] [PATCH] qemu-ga: remove useless allocation
Date: Fri, 26 May 2017 16:35:59 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 05/26/2017 07:13 AM, Marc-André Lureau wrote:
There is no need to duplicate a fixed string.

CC: address@hidden
Signed-off-by: Marc-André Lureau <address@hidden>

Reviewed-by: Philippe Mathieu-Daudé <address@hidden>

---
 qga/commands-posix.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/qga/commands-posix.c b/qga/commands-posix.c
index 284ecc6d7e..d8e412275e 100644
--- a/qga/commands-posix.c
+++ b/qga/commands-posix.c
@@ -2197,12 +2197,10 @@ static void transfer_memory_block(GuestMemoryBlock 
*mem_blk, bool sys2memblk,
         }
     } else {
         if (mem_blk->online != (strncmp(status, "online", 6) == 0)) {
-            char *new_state = mem_blk->online ? g_strdup("online") :
-                                                g_strdup("offline");
+            const char *new_state = mem_blk->online ? "online" : "offline";

             ga_write_sysfs_file(dirfd, "state", new_state, strlen(new_state),
                                 &local_err);
-            g_free(new_state);
             if (local_err) {
                 error_free(local_err);
                 result->response =




reply via email to

[Prev in Thread] Current Thread [Next in Thread]