mirror of
				https://github.com/msgpack/msgpack-c.git
				synced 2025-10-29 20:59:46 +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:
		| @@ -226,12 +226,12 @@ inline bool unpacker::next(unpacked* result) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if(ret == 0) { | 	if(ret == 0) { | ||||||
| 		if (result->zone().get() != NULL) result->zone().reset(); | 		result->zone().reset(); | ||||||
| 		result->get() = object(); | 		result->get() = object(); | ||||||
| 		return false; | 		return false; | ||||||
|  |  | ||||||
| 	} else { | 	} else { | ||||||
| 		if (result->zone().get() != NULL) result->zone().reset( release_zone() ); | 		result->zone().reset( release_zone() ); | ||||||
| 		result->get() = data(); | 		result->get() = data(); | ||||||
| 		reset(); | 		reset(); | ||||||
| 		return true; | 		return true; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Takatoshi Kondo
					Takatoshi Kondo