We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 287f34c commit d62b610Copy full SHA for d62b610
src/libmongoc/tests/test-conveniences.c
@@ -639,18 +639,21 @@ match_json (const bson_t *doc,
639
matches = match_bson_with_ctx (doc, pattern, &ctx);
640
641
if (!matches) {
642
+ char *as_string =
643
+ doc ? bson_as_canonical_extended_json (doc, NULL) : NULL;
644
fprintf (stderr,
645
"ASSERT_MATCH failed with document:\n\n"
646
"%s\n"
647
"pattern:\n%s\n"
648
649
"%s:%d %s()\n",
- doc ? bson_as_canonical_extended_json (doc, NULL) : "{}",
650
+ as_string ? as_string : "{}",
651
double_quoted,
652
ctx.errmsg,
653
filename,
654
lineno,
655
funcname);
656
+ bson_free (as_string);
657
}
658
659
bson_destroy (pattern);
0 commit comments