aboutsummaryrefslogtreecommitdiff
path: root/target-i386/kvm.c
diff options
context:
space:
mode:
authorMarkus Armbruster <armbru@redhat.com>2014-12-04 14:46:45 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2014-12-15 12:21:02 +0100
commitab3ad07f89c7f9e03c17c98e1d1a02dbf61c605c (patch)
tree13eeaac95f3437959d8e861ff4207a0db70264af /target-i386/kvm.c
parent4be34d1e2140b6d1be611c4bfa542c54c232520b (diff)
downloadqemu-ab3ad07f89c7f9e03c17c98e1d1a02dbf61c605c.zip
qemu-ab3ad07f89c7f9e03c17c98e1d1a02dbf61c605c.tar.gz
qemu-ab3ad07f89c7f9e03c17c98e1d1a02dbf61c605c.tar.bz2
x86: Use g_new() & friends where that makes obvious sense
g_new(T, n) is neater than g_malloc(sizeof(T) * n). It's also safer, for two reasons. One, it catches multiplication overflowing size_t. Two, it returns T * rather than void *, which lets the compiler catch more type errors. This commit only touches allocations with size arguments of the form sizeof(T). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'target-i386/kvm.c')
-rw-r--r--target-i386/kvm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 60c4475..8832a02 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -278,7 +278,7 @@ static void kvm_hwpoison_page_add(ram_addr_t ram_addr)
return;
}
}
- page = g_malloc(sizeof(HWPoisonPage));
+ page = g_new(HWPoisonPage, 1);
page->ram_addr = ram_addr;
QLIST_INSERT_HEAD(&hwpoison_page_list, page, list);
}