Skip to content

Commit

Permalink
qemu-ga: remove useless allocation
Browse files Browse the repository at this point in the history
There is no need to duplicate a fixed string.

Signed-off-by: Marc-André Lureau <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Michael Tokarev <[email protected]>
  • Loading branch information
elmarco authored and Michael Tokarev committed Jun 4, 2017
1 parent 3975bb5 commit 7064024
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions qga/commands-posix.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 7064024

Please sign in to comment.