X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fwrite_mongodb.c;h=4deb24d30979c748c546eaed464fb01113814fdc;hb=970acd869b9a8ef076ed5434b2a26ab3217750ce;hp=704ac0710382af0ed994b7b035a295f8200f3044;hpb=fc5c43d7db4f05aae907eec5b0c5121bcf650709;p=collectd.git diff --git a/src/write_mongodb.c b/src/write_mongodb.c index 704ac071..4deb24d3 100644 --- a/src/write_mongodb.c +++ b/src/write_mongodb.c @@ -92,6 +92,7 @@ static int wm_write (const data_set_t *ds, /* {{{ */ else assert (23 == 42); } + /* We must finish the record, other wise the insert will fail */ bson_finish(&record); pthread_mutex_lock (&node->lock); @@ -129,6 +130,8 @@ static int wm_write (const data_set_t *ds, /* {{{ */ } pthread_mutex_unlock (&node->lock); + /* free our resource as not to leak memory */ + bson_destroy(&record); return (0); } /* }}} int wm_write */