mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
tests: virNumaGetPages: use g_new0 instead of VIR_ALLOC_N
Signed-off-by: Ján Tomko <jtomko@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
8b80d9f0f9
commit
bff6aee4ca
@ -133,23 +133,13 @@ virNumaGetPages(int node,
|
||||
size_t i = 0;
|
||||
|
||||
if (pages_size)
|
||||
*pages_size = NULL;
|
||||
*pages_size = g_new0(unsigned int, npages_def);
|
||||
|
||||
if (pages_avail)
|
||||
*pages_avail = NULL;
|
||||
*pages_avail = g_new0(unsigned long long, npages_def);
|
||||
|
||||
if (pages_free)
|
||||
*pages_free = NULL;
|
||||
|
||||
*npages = 0;
|
||||
|
||||
if ((pages_size && VIR_ALLOC_N(*pages_size, npages_def) < 0) ||
|
||||
(pages_avail && VIR_ALLOC_N(*pages_avail, npages_def) < 0) ||
|
||||
(pages_free && VIR_ALLOC_N(*pages_free, npages_def) < 0)) {
|
||||
VIR_FREE(*pages_size);
|
||||
VIR_FREE(*pages_avail);
|
||||
return -1;
|
||||
}
|
||||
*pages_free = g_new0(unsigned long long, npages_def);
|
||||
|
||||
*npages = npages_def;
|
||||
if (pages_size)
|
||||
|
Loading…
x
Reference in New Issue
Block a user