Skip to content

Commit f4e5adb

Browse files
alexeyvohanumantmk
authored andcommitted
Fix empty errors if mongoc_database_remove_user\mongoc_database_remove_all_users fails
Closes #146
1 parent 7a743b6 commit f4e5adb

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/mongoc/mongoc-database.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ mongoc_database_remove_user (mongoc_database_t *database,
331331

332332
bson_destroy (&cmd);
333333
mongoc_collection_destroy (col);
334+
} else if (error) {
335+
memcpy (error, &lerror, sizeof *error);
334336
}
335337

336338
RETURN (ret);
@@ -367,6 +369,8 @@ mongoc_database_remove_all_users (mongoc_database_t *database,
367369

368370
bson_destroy (&cmd);
369371
mongoc_collection_destroy (col);
372+
} else if (error) {
373+
memcpy (error, &lerror, sizeof *error);
370374
}
371375

372376
RETURN (ret);

0 commit comments

Comments
 (0)