[libvirt PATCH 03/21] util: Use glib memory functions in virBitmapNewQuiet

Tim Wiederhake posted 21 patches 5 years, 5 months ago
There is a newer version of this series
[libvirt PATCH 03/21] util: Use glib memory functions in virBitmapNewQuiet
Posted by Tim Wiederhake 5 years, 5 months ago
Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
---
 src/util/virbitmap.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/src/util/virbitmap.c b/src/util/virbitmap.c
index 60fd8491dd..639103e518 100644
--- a/src/util/virbitmap.c
+++ b/src/util/virbitmap.c
@@ -69,14 +69,8 @@ virBitmapNewQuiet(size_t size)
 
     sz = VIR_DIV_UP(size, VIR_BITMAP_BITS_PER_UNIT);
 
-    if (VIR_ALLOC_QUIET(bitmap) < 0)
-        return NULL;
-
-    if (VIR_ALLOC_N_QUIET(bitmap->map, sz) < 0) {
-        VIR_FREE(bitmap);
-        return NULL;
-    }
-
+    bitmap = g_new0(virBitmap, 1);
+    bitmap->map = g_new0(unsigned long, sz);
     bitmap->nbits = size;
     bitmap->map_len = sz;
     bitmap->map_alloc = sz;
-- 
2.26.2

Re: [libvirt PATCH 03/21] util: Use glib memory functions in virBitmapNewQuiet
Posted by Ján Tomko 5 years, 5 months ago
On a Friday in 2020, Tim Wiederhake wrote:
>Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
>---
> src/util/virbitmap.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano