Skip to content

Commit d5dfc9f

Browse files
authored
CDRIVER-3008 fix possible leak in run_json_general_test (#1347)
* CDRIVER-3008 fix possible leak in test * document example use of `MONGOC_JSON_SUBTEST`
1 parent 797b371 commit d5dfc9f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,12 @@ Specification tests may be filtered by their description:
296296

297297
* `MONGOC_JSON_SUBTEST=<string>`
298298

299-
This can be useful in debugging a specific test case in a spec test file with multiple tests.
299+
This can be useful in debugging a specific test case in a spec test file with multiple tests. Example:
300+
301+
```sh
302+
MONGOC_JSON_SUBTEST="Insert with randomized encryption, then find it" \
303+
./cmake-build/src/libmongoc/test-libmongoc -l "/client_side_encryption/legacy/basic"
304+
```
300305

301306
To test with a declared API version, you can pass the API version using an environment variable:
302307

src/libmongoc/tests/json-test.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,6 +1824,7 @@ run_json_general_test (const json_test_config_t *config)
18241824
bson_free (selected_test);
18251825
continue;
18261826
}
1827+
bson_free (selected_test);
18271828

18281829
if (bson_has_field (&test, "skipReason")) {
18291830
fprintf (stderr,
@@ -1862,8 +1863,6 @@ run_json_general_test (const json_test_config_t *config)
18621863
}
18631864
}
18641865

1865-
bson_free (selected_test);
1866-
18671866
uri = (config->uri_str != NULL) ? mongoc_uri_new (config->uri_str)
18681867
: test_framework_get_uri ();
18691868

0 commit comments

Comments
 (0)