Skip to content

Commit dc1698e

Browse files
committed
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.
2 parents 8a2c50c + 53ded06 commit dc1698e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/msgpack/unpack.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,12 @@ inline bool unpacker::next(unpacked* result)
226226
}
227227

228228
if(ret == 0) {
229-
if (result->zone().get() != NULL) result->zone().reset();
229+
result->zone().reset();
230230
result->get() = object();
231231
return false;
232232

233233
} else {
234-
if (result->zone().get() != NULL) result->zone().reset( release_zone() );
234+
result->zone().reset( release_zone() );
235235
result->get() = data();
236236
reset();
237237
return true;

0 commit comments

Comments
 (0)