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:
1 parent
2689d3f65a
commit
335f3cc6d6
2 files changed
+1
-2
No files matched your search
+1
-1
@@ -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>
|
||||
|
||||
|
||||
Reference in new issue
Block a user