[PATCH 25/33] util: iohelper: Don't handle OOM from posix_memalign

Peter Krempa pkrempa at redhat.com
Wed Feb 24 16:17:00 UTC 2021


Similarly to other allocation calls abort() on failure.

Signed-off-by: Peter Krempa <pkrempa at redhat.com>
---
 src/util/iohelper.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/util/iohelper.c b/src/util/iohelper.c
index 49d939d290..b8810d16d3 100644
--- a/src/util/iohelper.c
+++ b/src/util/iohelper.c
@@ -27,6 +27,7 @@

 #include <unistd.h>
 #include <fcntl.h>
+#include <stdlib.h>

 #include "virthread.h"
 #include "virfile.h"
@@ -57,10 +58,8 @@ runIO(const char *path, int fd, int oflags)
     off_t end = 0;

 #if WITH_POSIX_MEMALIGN
-    if (posix_memalign(&base, alignMask + 1, buflen)) {
-        virReportOOMError();
-        goto cleanup;
-    }
+    if (posix_memalign(&base, alignMask + 1, buflen))
+        abort();
     buf = base;
 #else
     buf = g_new0(char, buflen + alignMask);
-- 
2.29.2




More information about the libvir-list mailing list