Details
-
Bug
-
Resolution: Done
-
Unknown
-
None
-
None
-
None
-
Not Needed
Description
In _fle2_insert_encryptionInformation in mongocrypt-ctx-encrypt.c, a Valgrind memory leak can occur when the libbson BSON_MEMCHECK compile flag is set because:
- bson_t explain is initialized on line 222 (as of commit 073a95) but is then passed as the dst argument to bson_copy_to on line 275 which requires that dst be uninitialized to avoid leaking memory (documentation)
- bson_t out is initialized on line 221, but if the goto success statement on line 246 is hit, then out never gets bson_destroy-ed before the function exits