[#205] openbsd system call changes — Jamie Herre <jfh@...>
Hi,
7 messages
2002/07/05
[#216] lib/mkfm.rb: have_bin()/find_bin() — Sean Chittenden <sean@...>
This could be me over looking something, but in mkmf.rb, there is no
7 messages
2002/07/07
[#221] Wiring up the Boehm GC to the Ruby interpreter — Matthew Bloch <matthew@...>(by way of Matthew Bloch <mattbee@...>)
Hi there;
4 messages
2002/07/12
[#228] Patch to stop TCPSocket.new blocking on DNS lookups — Matthew Bloch <mattbee@...>
Hello;
6 messages
2002/07/17
[#237] object.c ruby.h (fwd) — Robert Skarwecki <skaav@...>
Hello everybody,
42 messages
2002/07/24
[#239] Re: [PATCH] object.c ruby.h (fwd)
— GOTO Kentaro <gotoken@...>
2002/07/24
At Thu, 25 Jul 2002 00:02:28 +0900,
[#240] Re: [PATCH] object.c ruby.h (fwd)
— Dave Thomas <Dave@...>
2002/07/24
GOTO Kentaro <gotoken@notwork.org> writes:
[#246] Re: [PATCH] object.c ruby.h (fwd)
— GOTO Kentaro <gotoken@...>
2002/07/25
At Thu, 25 Jul 2002 05:05:46 +0900,
[#247] Re: [PATCH] object.c ruby.h (fwd)
— Dave Thomas <Dave@...>
2002/07/25
GOTO Kentaro <gotoken@notwork.org> writes:
[#248] Re: [PATCH] object.c ruby.h (fwd)
— nobu.nokada@...
2002/07/25
Hi,
[#249] Re: [PATCH] object.c ruby.h (fwd)
— Dave Thomas <Dave@...>
2002/07/25
nobu.nokada@softhome.net writes:
[#250] Re: [PATCH] object.c ruby.h (fwd)
— nobu.nokada@...
2002/07/25
Hi,
[#252] Re: [PATCH] object.c ruby.h (fwd)
— GOTO Kentaro <gotoken@...>
2002/07/25
At Fri, 26 Jul 2002 03:11:02 +0900,
[#253] Re: [PATCH] object.c ruby.h (fwd)
— Dave Thomas <Dave@...>
2002/07/25
GOTO Kentaro <gotoken@notwork.org> writes:
[#255] Re: [PATCH] object.c ruby.h (fwd)
— GOTO Kentaro <gotoken@...>
2002/07/25
At Fri, 26 Jul 2002 05:34:10 +0900,
[#268] Re: [PATCH] object.c ruby.h (fwd)
— Masaki Suketa <masaki.suketa@...>
2002/07/27
In message "Re: [PATCH] object.c ruby.h (fwd)"
[#269] Re: [PATCH] object.c ruby.h (fwd)
— Dave Thomas <Dave@...>
2002/07/27
Masaki Suketa <masaki.suketa@nifty.ne.jp> writes:
[#288] Re: [PATCH] object.c ruby.h (fwd)
— Masaki Suketa <masaki.suketa@...>
2002/08/03
In message "Re: [PATCH] object.c ruby.h (fwd)"
[#295] Re: [PATCH] object.c ruby.h (fwd)
— "NAKAMURA, Hiroshi" <nahi@...>
2002/08/05
Hi,
[#260] Re: [PATCH] object.c ruby.h (fwd)
— kjana@...4lab.to (YANAGAWA Kazuhisa)
2002/07/26
In message <m2bs8vr1h7.fsf@zip.local.thomases.com>
[#279] A truth? patch + benchmarks
— "Christoph" <chr_news@...>
2002/07/31
[#280] Re: A truth? patch + benchmarks
— ts <decoux@...>
2002/07/31
>>>>> "C" == Christoph <chr_news@gmx.net> writes:
[#283] RE: A truth? patch + benchmarks
— "Christoph" <chr_news@...>
2002/08/01
[#241] Compiling ruby on SGI origins — Bil Kleb <W.L.Kleb@...>
I just tried compiling ruby-1.6.7 on a couple SGI origins (mips-sgi-irix6.5),
6 messages
2002/07/25
Mem leaks in rb_str_become?
From:
Michal Rokos <m.rokos@...>
Date:
2002-07-04 09:54:59 UTC
List:
ruby-core #199
Hi,
I'm not sure is following code doesn't mem leaks...
(Whole DIFF included - code will be marked)
Index: string.c
===================================================================
RCS file: /src/ruby/string.c,v
retrieving revision 1.106
diff -u -r1.106 string.c
--- string.c 2002/06/18 06:29:05 1.106
+++ string.c 2002/07/04 09:48:04
@@ -56,19 +56,24 @@
const char *ptr;
long len;
{
- VALUE str = rb_obj_alloc(klass);
-
+ VALUE str;
+
if (len < 0) {
rb_raise(rb_eArgError, "negative string size (or size too big)");
}
-
+
+ str = rb_obj_alloc(klass);
RSTRING(str)->len = len;
RSTRING(str)->aux.capa = len;
- RSTRING(str)->ptr = ALLOC_N(char,len+1);
+ RSTRING(str)->ptr = ALLOC_N(char, len + 1);
+
if (ptr) {
memcpy(RSTRING(str)->ptr, ptr, len);
+ } else {
+ memset(RSTRING(str)->ptr, '\0', len);
}
RSTRING(str)->ptr[len] = '\0';
+
return str;
}
@@ -115,8 +120,11 @@
str_new3(klass, str)
VALUE klass, str;
{
- VALUE str2 = rb_obj_alloc(klass);
-
+ VALUE str2;
+
+ Check_Type(str, T_STRING);
+
+ str2 = rb_obj_alloc(klass);
RSTRING(str2)->len = RSTRING(str)->len;
RSTRING(str2)->ptr = RSTRING(str)->ptr;
RSTRING(str2)->aux.shared = str;
@@ -139,6 +147,8 @@
{
VALUE klass, str;
+ Check_Type(orig, T_STRING);
+
klass = rb_obj_class(orig);
if (FL_TEST(orig, ELTS_SHARED)) {
str = str_new3(klass, RSTRING(orig)->aux.shared);
@@ -176,12 +186,13 @@
{
VALUE str = rb_obj_alloc(rb_cString);
- if (capa < STR_BUF_MIN_SIZE)
+ if (capa < STR_BUF_MIN_SIZE) {
capa = STR_BUF_MIN_SIZE;
+ }
RSTRING(str)->ptr = 0;
RSTRING(str)->len = 0;
RSTRING(str)->aux.capa = capa;
- RSTRING(str)->ptr = ALLOC_N(char, capa+1);
+ RSTRING(str)->ptr = ALLOC_N(char, capa + 1);
RSTRING(str)->ptr[0] = '\0';
return str;
@@ -194,7 +205,7 @@
VALUE str;
long len = strlen(ptr);
- str = rb_str_buf_new(len + STR_BUF_MIN_SIZE);
+ str = rb_str_buf_new(len);
rb_str_cat(str, ptr, len);
return str;
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Here could be a problem: (in rb_str_become)
@@ -213,12 +224,13 @@
{
if (str == str2) return;
if (NIL_P(str2)) {
- RSTRING(str)->ptr = 0;
+ RSTRING(str)->ptr = 0; /* FIXME: MEM LEAKs here ???*/
RSTRING(str)->len = 0;
RSTRING(str)->aux.capa = 0;
return;
}
- if (FL_TEST(str, ELTS_SHARED)) free(RSTRING(str)->ptr);
+ Check_Type(str2, T_STRING);
+ if (FL_TEST(str, ELTS_SHARED)) free(RSTRING(str)->ptr); /* NOTE: What happends to ->ptr in orig STRING if we free this one??? BUG? */
RSTRING(str)->ptr = RSTRING(str2)->ptr;
RSTRING(str)->len = RSTRING(str2)->len;
if (FL_TEST(str2, ELTS_SHARED|STR_ASSOC)) {
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Michal
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Michal Rokos Czech Technical University, Prague
E-mail:m.rokos@sh.cvut.cz ICQ:36118339 Jabber:majkl@jabber.cz
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-