Skip to content

Commit

Permalink
* io.c (io_unread): fixed memory leak. report by nagachika via IRC.
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
unak committed Mar 27, 2012
1 parent 61dc4a8 commit 9073db5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ChangeLog
@@ -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
Expand Down
2 changes: 2 additions & 0 deletions io.c
Expand Up @@ -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) {
Expand All @@ -483,6 +484,7 @@ io_unread(rb_io_t *fptr)
newlines--;
}
}
free(buf);
fptr->rbuf.off = 0;
fptr->rbuf.len = 0;
return;
Expand Down

0 comments on commit 9073db5

Please sign in to comment.