[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH 3/3] ruby: Use ALLOC_N to avoid potential memory leak



-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
>From cf26ef818e918c8c32658399e8aa9e31289109a7 Mon Sep 17 00:00:00 2001
From: Richard W.M. Jones <rjones redhat com>
Date: Tue, 15 Mar 2011 15:00:58 +0000
Subject: [PATCH 3/3] ruby: Use ALLOC_N to avoid potential memory leak (RHBZ#667610).

---
 generator/generator_ruby.ml |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/generator/generator_ruby.ml b/generator/generator_ruby.ml
index 8be9369..84d10e0 100644
--- a/generator/generator_ruby.ml
+++ b/generator/generator_ruby.ml
@@ -367,7 +367,7 @@ get_all_event_callbacks (guestfs_h *g, size_t *len_rtn)
             pr "  {\n";
             pr "    size_t i, len;\n";
             pr "    len = RARRAY_LEN (%sv);\n" n;
-            pr "    %s = guestfs_safe_malloc (g, sizeof (char *) * (len+1));\n"
+            pr "    %s = ALLOC_N (char *, len+1);\n"
               n;
             pr "    for (i = 0; i < len; ++i) {\n";
             pr "      VALUE v = rb_ary_entry (%sv, i);\n" n;
-- 
1.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]