[#84280] [Ruby trunk Bug#14181] hangs or deadlocks from waitpid, threads, and trapping SIGCHLD — nobu@...
Issue #14181 has been updated by nobu (Nobuyoshi Nakada).
3 messages
2017/12/15
[#84398] [Ruby trunk Bug#14220] WEBrick changes - failures on MSWIN, MinGW — Greg.mpls@...
Issue #14220 has been reported by MSP-Greg (Greg L).
3 messages
2017/12/22
[#84472] Re: [ruby-dev:50394] [Ruby trunk Bug#14240] warn four special variables: $; $, $/ $\ — Eric Wong <normalperson@...>
Shouldn't English posts be on ruby-core instead of ruby-dev?
3 messages
2017/12/26
[ruby-core:84388] Re: [ruby-cvs:68567] nobu:r61386 (trunk): string.c: fix memory leak
From:
Eric Wong <normalperson@...>
Date:
2017-12-21 08:30:54 UTC
List:
ruby-core #84388
nobu@ruby-lang.org wrote:
> https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61386
rb_enc_find_index may raise, so ALLOCV should be safer;
(the allocation is bound at 101 bytes, even alloca is fine)
--- a/string.c
+++ b/string.c
@@ -6266,6 +6266,7 @@ str_undump(VALUE str)
char *buf;
int encidx;
ptrdiff_t size;
+ VALUE v;
if (utf8) {
rb_raise(rb_eRuntimeError, "dumped string contained Unicode escape but used force_encoding");
@@ -6283,11 +6284,11 @@ str_undump(VALUE str)
if (size > 100) {
rb_raise(rb_eRuntimeError, "dumped string has unknown encoding name");
}
- buf = ALLOC_N(char, size+1);
+ buf = ALLOCV(v, size+1);
memcpy(buf, encname, size);
buf[size] = '\0';
encidx = rb_enc_find_index(buf);
- xfree(buf);
+ ALLOCV_END(v);
if (encidx < 0) {
rb_raise(rb_eRuntimeError, "dumped string has unknown encoding name");
}
Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>