Skip to content

Commit 10c4735

Browse files
committed
CDRIVER-2719 leak in change stream test
1 parent 00fde82 commit 10c4735

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libmongoc/tests/test-mongoc-change-stream.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,8 @@ typedef struct {
12481248
bson_t agg_reply;
12491249
} resume_at_optime_ctx_t;
12501250

1251+
#define RESUME_AT_OPTIME_INITIALIZER { false, false, BSON_INITIALIZER}
1252+
12511253
static void
12521254
_resume_at_optime_started (const mongoc_apm_command_started_t *event)
12531255
{
@@ -1286,6 +1288,7 @@ _resume_at_optime_succeeded (const mongoc_apm_command_succeeded_t *event)
12861288
event);
12871289
if (!strcmp (mongoc_apm_command_succeeded_get_command_name (event),
12881290
"aggregate")) {
1291+
bson_destroy (&ctx->agg_reply);
12891292
bson_copy_to (mongoc_apm_command_succeeded_get_reply (event),
12901293
&ctx->agg_reply);
12911294
}
@@ -1301,7 +1304,7 @@ test_change_stream_resume_at_optime (void *test_ctx)
13011304
const bson_t *doc;
13021305
bson_error_t error;
13031306
mongoc_apm_callbacks_t *callbacks;
1304-
resume_at_optime_ctx_t ctx = {0};
1307+
resume_at_optime_ctx_t ctx = RESUME_AT_OPTIME_INITIALIZER;
13051308

13061309
callbacks = mongoc_apm_callbacks_new ();
13071310
mongoc_apm_set_command_started_cb (callbacks, _resume_at_optime_started);

0 commit comments

Comments
 (0)