From b655b3ddd4579932d22679fe44a85fadb2a0f749 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Mon, 15 Jun 2026 05:01:44 +0900 Subject: [PATCH] Alloc token data in factory instead of alloc func --- bindings/ruby/ext/ruby_whisper_parakeet_token.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bindings/ruby/ext/ruby_whisper_parakeet_token.c b/bindings/ruby/ext/ruby_whisper_parakeet_token.c index e1da3e413..a00b7ae1c 100644 --- a/bindings/ruby/ext/ruby_whisper_parakeet_token.c +++ b/bindings/ruby/ext/ruby_whisper_parakeet_token.c @@ -101,7 +101,7 @@ ruby_whisper_parakeet_token_s_allocate(VALUE klass) ruby_whisper_parakeet_token *rwpt; VALUE token = TypedData_Make_Struct(klass, ruby_whisper_parakeet_token, &ruby_whisper_parakeet_token_type, rwpt); - rwpt->token_data = ALLOC(parakeet_token_data); + rwpt->token_data = NULL; rwpt->text = Qnil; return token; @@ -114,6 +114,7 @@ ruby_whisper_parakeet_token_s_from_token_data(struct parakeet_context *context, ruby_whisper_parakeet_token *rwpt; TypedData_Get_Struct(token, ruby_whisper_parakeet_token, &ruby_whisper_parakeet_token_type, rwpt); + rwpt->token_data = ALLOC(parakeet_token_data); *rwpt->token_data = *token_data; rwpt->text = rb_utf8_str_new_cstr(parakeet_token_to_str(context, token_data->id));