diff options
| author | Jean Boussier <jean.boussier@gmail.com> | 2024-11-25 13:05:18 +0100 |
|---|---|---|
| committer | Jean Boussier <jean.boussier@gmail.com> | 2024-11-25 18:18:39 +0100 |
| commit | cedcf2d681f08f8bed8ef8f3a8bd4e67d4a04c77 (patch) | |
| tree | fb43167bbb2dd5c8ec1f3bedcb6d7726fc9e1355 | |
| parent | 1d510a952d7345ffbe4565f417aeb1322dd1a8ac (diff) | |
error.c: call `va_end` before jumping
The man page is clear that every `va_start` call MUST be succeeded by
the corresponding `va_end` call.
So `rb_raise` can't call `rb_exc_raise` before `va_end`, otherwise
`va_end` is never called.
Co-Authored-By: Étienne Barrié <etienne.barrie@gmail.com>
| -rw-r--r-- | error.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -3632,12 +3632,13 @@ rb_vraise(VALUE exc, const char *fmt, va_list ap) } void -rb_raise(VALUE exc, const char *fmt, ...) +rb_raise(VALUE exc_class, const char *fmt, ...) { va_list args; va_start(args, fmt); - rb_vraise(exc, fmt, args); + VALUE exc = rb_exc_new3(exc_class, rb_vsprintf(fmt, args)); va_end(args); + rb_exc_raise(exc); } NORETURN(static void raise_loaderror(VALUE path, VALUE mesg)); |
