[Libguestfs] [PATCH 6/7] ruby: Stop using the safe_malloc, etc. functions.

Richard W.M. Jones rjones at redhat.com
Fri Feb 5 14:21:40 UTC 2016


---
 generator/ruby.ml | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/generator/ruby.ml b/generator/ruby.ml
index 1b05bf7..db222ea 100644
--- a/generator/ruby.ml
+++ b/generator/ruby.ml
@@ -260,7 +260,9 @@ set_event_callback (VALUE gv, VALUE cbv, VALUE event_bitmaskv)
 
   event_bitmask = NUM2ULL (event_bitmaskv);
 
-  root = guestfs_int_safe_malloc (g, sizeof *root);
+  root = malloc (sizeof *root);
+  if (root == NULL)
+    rb_raise (rb_eNoMemError, \"malloc: %%m\");
   *root = cbv;
 
   eh = guestfs_set_event_callback (g, event_callback_wrapper,
@@ -431,7 +433,9 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
   }
 
   /* Copy them into the return array. */
-  r = guestfs_int_safe_malloc (g, sizeof (VALUE *) * (*len_rtn));
+  r = malloc (sizeof (VALUE *) * (*len_rtn));
+  if (r == NULL)
+    rb_raise (rb_eNoMemError, \"malloc: %%m\");
 
   i = 0;
   root = guestfs_first_private (g, &key);
-- 
2.5.0




More information about the Libguestfs mailing list