1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* io.c (io_unread): fixed memory leak. report by nagachika via IRC.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2012-03-27 14:44:32 +00:00
parent 61dc4a8dbc
commit 9073db5cb1
2 changed files with 6 additions and 0 deletions

View file

@ -1,3 +1,7 @@
Tue Mar 27 23:44:11 2012 NAKAMURA Usaku <usa@ruby-lang.org>
* io.c (io_unread): fixed memory leak. report by nagachika via IRC.
Tue Mar 27 22:44:23 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* configure.in (verconf.h): separate load path specific stuff from

2
io.c
View file

@ -473,6 +473,7 @@ io_unread(rb_io_t *fptr)
}
read_size = _read(fptr->fd, buf, fptr->rbuf.len + newlines);
if (read_size < 0) {
free(buf);
rb_sys_fail_path(fptr->pathv);
}
if (read_size == fptr->rbuf.len) {
@ -483,6 +484,7 @@ io_unread(rb_io_t *fptr)
newlines--;
}
}
free(buf);
fptr->rbuf.off = 0;
fptr->rbuf.len = 0;
return;