summaryrefslogtreecommitdiff
path: root/qga
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2017-05-26 14:13:37 +0400
committerMichael Tokarev <mjt@tls.msk.ru>2017-06-04 18:42:55 +0300
commit7064024dee8eb8af89fe6f0d93983b7de2c72ecc (patch)
tree4312ad0a0f7dda50bc71eccb202c39a2a65b420e /qga
parent3975bb56a7d39ba26211fc5fe4211cef766fd838 (diff)
downloadqemu-7064024dee8eb8af89fe6f0d93983b7de2c72ecc.tar.gz
qemu-ga: remove useless allocation
There is no need to duplicate a fixed string. Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Diffstat (limited to 'qga')
-rw-r--r--qga/commands-posix.c4
1 files changed, 1 insertions, 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 =