mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* array.c, bignum.c, cont.c, dir.c, dln.c, encoding.c, enumerator.c,
enumerator.c (enumerator_allocate), eval_jump.c, file.c, hash.c, io.c, load.c, pack.c, proc.c, random.c, re.c, ruby.c, st.c, string.c, thread.c, thread_pthread.c, time.c, util.c, variable.c, vm.c, gc.c: allocated memory objects by xmalloc (ruby_xmalloc) should be freed by xfree (ruby_xfree). * ext/curses/curses.c, ext/dbm/dbm.c, ext/digest/digest.c, ext/gdbm/gdbm.c, ext/json/ext/parser/parser.c, ext/json/ext/parser/unicode.c, ext/openssl/ossl_cipher.c, ext/openssl/ossl_hmac.c, ext/openssl/ossl_pkey_ec.c, ext/sdbm/init.c, ext/strscan/strscan.c, ext/zlib/zlib.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@17017 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4a7311e129
commit
72ba13aa8e
40 changed files with 133 additions and 118 deletions
|
|
@ -1705,7 +1705,7 @@ static void JSON_mark(JSON_Parser *json)
|
|||
|
||||
static void JSON_free(JSON_Parser *json)
|
||||
{
|
||||
free(json);
|
||||
ruby_xfree(json);
|
||||
}
|
||||
|
||||
static VALUE cJSON_parser_s_allocate(VALUE klass)
|
||||
|
|
|
|||
|
|
@ -105,12 +105,12 @@ char *JSON_convert_UTF16_to_UTF8 (
|
|||
+ (ch2 - UNI_SUR_LOW_START) + halfBase;
|
||||
++tmpPtr;
|
||||
} else if (flags == strictConversion) { /* it's an unpaired high surrogate */
|
||||
free(tmp);
|
||||
ruby_xfree(tmp);
|
||||
rb_raise(rb_path2class("JSON::ParserError"),
|
||||
"source sequence is illegal/malformed near %s", source);
|
||||
}
|
||||
} else { /* We don't have the 16 bits following the high surrogate. */
|
||||
free(tmp);
|
||||
ruby_xfree(tmp);
|
||||
rb_raise(rb_path2class("JSON::ParserError"),
|
||||
"partial character in source, but hit end near %s", source);
|
||||
break;
|
||||
|
|
@ -118,7 +118,7 @@ char *JSON_convert_UTF16_to_UTF8 (
|
|||
} else if (flags == strictConversion) {
|
||||
/* UTF-16 surrogate values are illegal in UTF-32 */
|
||||
if (ch >= UNI_SUR_LOW_START && ch <= UNI_SUR_LOW_END) {
|
||||
free(tmp);
|
||||
ruby_xfree(tmp);
|
||||
rb_raise(rb_path2class("JSON::ParserError"),
|
||||
"source sequence is illegal/malformed near %s", source);
|
||||
}
|
||||
|
|
@ -150,7 +150,7 @@ char *JSON_convert_UTF16_to_UTF8 (
|
|||
}
|
||||
rb_str_buf_cat(buffer, p, bytesToWrite);
|
||||
}
|
||||
free(tmp);
|
||||
ruby_xfree(tmp);
|
||||
source += 5 + (n - 1) * 6;
|
||||
return source;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue