This leak was introduced in 84dbfe0 (PHPC-891). When throwing an exception for null bytes in public property names, we neglect to free obj_data if we were currently iterating through the hash of bsonSerialize()'s return value.
is related to
PHPC-891BSON encoding should throw if PHP keys contain null bytes
Closed
PHPC-948BSON encoding should throw on circular references