mongodb/mongo-c-driver — pull request #100 by jsbattig (2013-03-22 05:57:33+00:00)
Title: Added code to initialize bson to zero when dynamically allocating and fixed memleak on mongo.c

Added code on bson.c to initialize to zero newly allocated bson. The problem with not doing this, is that in many places a bson object is created in order to pass as reference to a function which will "fill it". but if anything fails and the data field, or owned field are not properly initialize further calls to bson_destroy fail badly.

Change to mongo.c fixed a memory leak initializing replicate set. When doing this, primary must be freed first before assigning a new pointer with malloc