diff options
author | Richard Jones <rjones@redhat.com> | 2009-04-30 14:01:53 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2009-04-30 14:01:53 +0100 |
commit | ab0397017cc26833c09946cca19d86b907822a94 (patch) | |
tree | 6bed84d3921570c84e7e6d9d9fc7b16889aa7c92 /ruby | |
parent | 6f5c3984a7ddfc111287e2ec214ba823db737db4 (diff) | |
download | libguestfs-ab0397017cc26833c09946cca19d86b907822a94.tar.gz libguestfs-ab0397017cc26833c09946cca19d86b907822a94.tar.xz libguestfs-ab0397017cc26833c09946cca19d86b907822a94.zip |
Use safe_malloc and/or check returns from malloc (Jim Meyering).
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/ext/guestfs/_guestfs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c index af80e3f5..e6c42365 100644 --- a/ruby/ext/guestfs/_guestfs.c +++ b/ruby/ext/guestfs/_guestfs.c @@ -1413,7 +1413,7 @@ static VALUE ruby_guestfs_vgcreate (VALUE gv, VALUE volgroupv, VALUE physvolsv) char **physvols; { int i, len; len = RARRAY_LEN (physvolsv); - physvols = malloc (sizeof (char *) * (len+1)); + physvols = guestfs_safe_malloc (g, sizeof (char *) * (len+1)); for (i = 0; i < len; ++i) { VALUE v = rb_ary_entry (physvolsv, i); physvols[i] = StringValueCStr (v); @@ -1499,7 +1499,7 @@ static VALUE ruby_guestfs_sfdisk (VALUE gv, VALUE devicev, VALUE cylsv, VALUE he char **lines; { int i, len; len = RARRAY_LEN (linesv); - lines = malloc (sizeof (char *) * (len+1)); + lines = guestfs_safe_malloc (g, sizeof (char *) * (len+1)); for (i = 0; i < len; ++i) { VALUE v = rb_ary_entry (linesv, i); lines[i] = StringValueCStr (v); @@ -1656,7 +1656,7 @@ static VALUE ruby_guestfs_command (VALUE gv, VALUE argumentsv) char **arguments; { int i, len; len = RARRAY_LEN (argumentsv); - arguments = malloc (sizeof (char *) * (len+1)); + arguments = guestfs_safe_malloc (g, sizeof (char *) * (len+1)); for (i = 0; i < len; ++i) { VALUE v = rb_ary_entry (argumentsv, i); arguments[i] = StringValueCStr (v); @@ -1686,7 +1686,7 @@ static VALUE ruby_guestfs_command_lines (VALUE gv, VALUE argumentsv) char **arguments; { int i, len; len = RARRAY_LEN (argumentsv); - arguments = malloc (sizeof (char *) * (len+1)); + arguments = guestfs_safe_malloc (g, sizeof (char *) * (len+1)); for (i = 0; i < len; ++i) { VALUE v = rb_ary_entry (argumentsv, i); arguments[i] = StringValueCStr (v); @@ -2336,7 +2336,7 @@ static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv) char **extraargs; { int i, len; len = RARRAY_LEN (extraargsv); - extraargs = malloc (sizeof (char *) * (len+1)); + extraargs = guestfs_safe_malloc (g, sizeof (char *) * (len+1)); for (i = 0; i < len; ++i) { VALUE v = rb_ary_entry (extraargsv, i); extraargs[i] = StringValueCStr (v); |