mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06: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;
|
size_t i = 0;
|
||||||
|
|
||||||
if (pages_size)
|
if (pages_size)
|
||||||
*pages_size = NULL;
|
*pages_size = g_new0(unsigned int, npages_def);
|
||||||
|
|
||||||
if (pages_avail)
|
if (pages_avail)
|
||||||
*pages_avail = NULL;
|
*pages_avail = g_new0(unsigned long long, npages_def);
|
||||||
|
|
||||||
if (pages_free)
|
if (pages_free)
|
||||||
*pages_free = NULL;
|
*pages_free = g_new0(unsigned long long, npages_def);
|
||||||
|
|
||||||
*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;
|
|
||||||
}
|
|
||||||
|
|
||||||
*npages = npages_def;
|
*npages = npages_def;
|
||||||
if (pages_size)
|
if (pages_size)
|
||||||
|
Loading…
Reference in New Issue
Block a user