mirror of
https://github.com/msgpack/msgpack-c.git
synced 2025-03-25 01:55:39 +01:00
Merge pull request #31 from redboltz/fix_buffer_leak
Fixed buffer leak bug. In the case of the function next() returns true: Whichever the argument result is holding the zone or not, the ownership of the zone always should be delegated from 'unpacker' to 'unpacked'. In the case of the function next() returns false: Whichever the argument result is holding the zone or not, the members of 'unpacked' should be reset.
This commit is contained in:
commit
dc1698eaf4
@ -226,12 +226,12 @@ inline bool unpacker::next(unpacked* result)
|
||||
}
|
||||
|
||||
if(ret == 0) {
|
||||
if (result->zone().get() != NULL) result->zone().reset();
|
||||
result->zone().reset();
|
||||
result->get() = object();
|
||||
return false;
|
||||
|
||||
} else {
|
||||
if (result->zone().get() != NULL) result->zone().reset( release_zone() );
|
||||
result->zone().reset( release_zone() );
|
||||
result->get() = data();
|
||||
reset();
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user