Use rb_enc_str_new instead of rb_enc_str_new_cstr.
The latter in combination with strndup() would leak large amounts of memory.
This commit is contained in:
parent
2689d3f65a
commit
335f3cc6d6
|
@ -13,7 +13,7 @@ void oga_xml_lexer_callback(
|
|||
)
|
||||
{
|
||||
int length = te - ts;
|
||||
VALUE value = rb_enc_str_new_cstr(strndup(ts, length), encoding);
|
||||
VALUE value = rb_enc_str_new(ts, length, encoding);
|
||||
VALUE method = rb_intern(name);
|
||||
|
||||
rb_funcall(self, method, 1, value);
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
|
||||
#include <ruby.h>
|
||||
#include <ruby/encoding.h>
|
||||
#include <string.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
Loading…
Reference in New Issue