Skip to content

Commit a02b8bc

Browse files
committed
fix uninitialized jump
1 parent 4858777 commit a02b8bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/libmongoc/src/mongoc/mongoc-client-session.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ txn_commit (mongoc_client_session_t *session,
208208
{
209209
bson_t cmd = BSON_INITIALIZER;
210210
bson_t opts = BSON_INITIALIZER;
211-
bson_error_t err_local;
211+
bson_error_t err_local = {0};
212212
bson_error_t *err_ptr = error ? error : &err_local;
213213
bson_t reply_local = BSON_INITIALIZER;
214214
mongoc_write_err_type_t error_type;
@@ -278,10 +278,10 @@ txn_commit (mongoc_client_session_t *session,
278278
/* Transactions Spec: "add the UnknownTransactionCommitResult error label
279279
* when commitTransaction fails with a network error, server selection
280280
* error, MaxTimeMSExpired error, or write concern failed / timeout." */
281-
if ((!r && err_ptr->domain == MONGOC_ERROR_SERVER_SELECTION) ||
281+
if (!r && (err_ptr->domain == MONGOC_ERROR_SERVER_SELECTION ||
282282
error_type == MONGOC_WRITE_ERR_RETRY ||
283283
error_type == MONGOC_WRITE_ERR_WRITE_CONCERN ||
284-
err_ptr->code == MONGOC_ERROR_MAX_TIME_MS_EXPIRED) {
284+
err_ptr->code == MONGOC_ERROR_MAX_TIME_MS_EXPIRED)) {
285285
/* Drivers MUST unpin a ClientSession when any individual
286286
* commitTransaction command attempt fails with an
287287
* UnknownTransactionCommitResult error label. Do this even if we won't

0 commit comments

Comments
 (0)