cleanup before rb_raise

This commit is contained in:
Doug MacEachern 2007-09-09 17:19:25 +00:00
parent 4989b9d107
commit a67de34fcd
1 changed files with 2 additions and 0 deletions

View File

@ -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);