Merge: Mongodb: fix C warnings and avoid crash caused by GC