From a67de34fcdcc8d0d8f56504b54d66e6200ec624f Mon Sep 17 00:00:00 2001 From: Doug MacEachern Date: Sun, 9 Sep 2007 17:19:25 +0000 Subject: [PATCH] cleanup before rb_raise --- bindings/SigarWrapper.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/SigarWrapper.pm b/bindings/SigarWrapper.pm index 3eb5f804..9e8a7eac 100644 --- a/bindings/SigarWrapper.pm +++ b/bindings/SigarWrapper.pm @@ -2192,7 +2192,9 @@ static VALUE rb_sigar_$cname($proto) $func->{sigar_type} *RETVAL = malloc(sizeof(*RETVAL)); if ((status = $func->{sigar_function}($args, RETVAL)) != SIGAR_OK) { + free(RETVAL); rb_raise(rb_eArgError, "%s", sigar_strerror(sigar, status)); + return Qnil; } return Data_Wrap_Struct($ruby_class, 0, rb_sigar_free, RETVAL);