Skip to content

Commit 442a639

Browse files
cschwarz-incoajdavis
authored andcommitted
ensure reply is initialized before returning
Signed-off-by: A. Jesse Jiryu Davis <[email protected]>
1 parent 5ab3877 commit 442a639

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

doc/mongoc_bulk_operation_execute.page

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ mongoc_bulk_operation_execute (mongoc_bulk_operation_t *bulk,
3131
<title>Parameters</title>
3232
<table>
3333
<tr><td><p>bulk</p></td><td><p>A <code xref="mongoc_bulk_operation_t">mongoc_bulk_operation_t</code>.</p></td></tr>
34-
<tr><td><p>reply</p></td><td><p>A <code xref="bson:bson_t">bson_t</code>.</p></td></tr>
34+
<tr><td><p>reply</p></td><td><p>An uninitialized <code xref="bson:bson_t">bson_t</code>.</p></td></tr>
3535
<tr><td><p>error</p></td><td><p>An optional location for a <code xref="errors">bson_error_t</code> or <code>NULL</code>.</p></td></tr>
3636
</table>
3737
</section>

src/mongoc/mongoc-bulk-operation.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,10 @@ mongoc_bulk_operation_execute (mongoc_bulk_operation_t *bulk, /* IN */
396396

397397
bulk->executed = true;
398398

399+
if (reply) {
400+
bson_init (reply);
401+
}
402+
399403
if (!bulk->client) {
400404
bson_set_error (error,
401405
MONGOC_ERROR_COMMAND,
@@ -419,10 +423,6 @@ mongoc_bulk_operation_execute (mongoc_bulk_operation_t *bulk, /* IN */
419423
RETURN (false);
420424
}
421425

422-
if (reply) {
423-
bson_init (reply);
424-
}
425-
426426
if (!bulk->commands.len) {
427427
bson_set_error (error,
428428
MONGOC_ERROR_COMMAND,

0 commit comments

Comments
 (0)