Skip to content

Commit

Permalink
should invoke va_end() before raising an execption.
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Jul 11, 2012
1 parent 7c58281 commit aff4435
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion class.c
Original file line number Diff line number Diff line change
Expand Up @@ -1242,8 +1242,10 @@ rb_scan_args(int argc, const VALUE *argv, const char *fmt, ...)

if (ISDIGIT(*p)) {
n = *p - '0';
if (n > argc)
if (n > argc) {
va_end(vargs);
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, n);
}
for (i=0; i<n; i++) {
var = va_arg(vargs, VALUE*);
if (var) *var = argv[i];
Expand Down

0 comments on commit aff4435

Please sign in to comment.