string.c: fix memory leak
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c364252926
commit
168c019998
1
string.c
1
string.c
@ -6287,6 +6287,7 @@ str_undump(VALUE str)
|
|||||||
memcpy(buf, encname, size);
|
memcpy(buf, encname, size);
|
||||||
buf[size] = '\0';
|
buf[size] = '\0';
|
||||||
encidx = rb_enc_find_index(buf);
|
encidx = rb_enc_find_index(buf);
|
||||||
|
xfree(buf);
|
||||||
if (encidx < 0) {
|
if (encidx < 0) {
|
||||||
rb_raise(rb_eRuntimeError, "dumped string has unknown encoding name");
|
rb_raise(rb_eRuntimeError, "dumped string has unknown encoding name");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user