aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2013-02-06 21:27:20 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2013-02-06 16:35:19 -0600
commit44f3bcd2c7991cc9d096e51e38864135543ea1ce (patch)
tree098b10e2391d1cc3dd618c19f144db9124d43cfd
parentc287e99fe47b179e6ef6b212139821b4d78934c1 (diff)
qmp: Drop wasteful zero-initialization in qmp_memchar_read()
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
-rw-r--r--qemu-char.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/qemu-char.c b/qemu-char.c
index 9d1c02cd1d..b0e4b41bcc 100644
--- a/qemu-char.c
+++ b/qemu-char.c
@@ -2819,7 +2819,7 @@ char *qmp_memchar_read(const char *device, int64_t size,
count = qemu_chr_cirmem_count(chr);
size = size > count ? count : size;
- read_data = g_malloc0(size + 1);
+ read_data = g_malloc(size + 1);
cirmem_chr_read(chr, read_data, size);
@@ -2827,6 +2827,7 @@ char *qmp_memchar_read(const char *device, int64_t size,
data = g_base64_encode(read_data, size);
g_free(read_data);
} else {
+ read_data[size] = 0;
data = (char *)read_data;
}