-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Not Needed
In _fle2_finalize in mongocrypt-ctx-encrypt.c, there are two potential memory leak errors that occur:
- The error case on line 1663 (as of commit 2ec9c3) should bson_destroy the converted and deleteTokens instances but is not currently doing so. (It also looks like the error case should return _mongocrypt_ctx_fail (ctx) instead of false in this case.)
- bson_copy_to on line 1617 (as of commit 2ec9c3) requires that the destination argument is an uninitialized bson_t (documentation) but line 1616 calls bson_init on the destination converted.
—
To reproduce, use
mkdir cmake-build && cd cmake-build cmake ../ make valgrind --leak-check=full ./test-mongocrypt