From empirical testing and code inspection, it appears that a number of mongoc_uri_*() methods with pointer return types which are not documented to return NULL can indeed return NULL.
The following is a list of all mongoc_uri_*() API functions from the 1.6.0 documentation, filtered down to exclude any function which either 1) doesn't return a pointer, or 2) is already documented to possibly return NULL. Please determine the subset of API functions for which callers must check for NULL before assuming the returned pointer is valid, and update the documentation accordingly for the functions in that subset.
- mongoc_uri_copy()
- mongoc_uri_get_auth_mechanism()
- mongoc_uri_get_auth_source()
- mongoc_uri_get_database()
- mongoc_uri_get_hosts()
- mongoc_uri_get_mechanism_properties()
- mongoc_uri_get_option_as_utf8()
- mongoc_uri_get_options()
- mongoc_uri_get_password()
- mongoc_uri_get_read_concern()
- mongoc_uri_get_read_prefs()
- mongoc_uri_get_read_prefs_t()
- mongoc_uri_get_replica_set()
- mongoc_uri_get_string()
- mongoc_uri_get_username()
- mongoc_uri_get_write_concern()
- mongoc_uri_new_for_host_port()
- mongoc_uri_unescape()
- related to
-
CXX-1187 mongocxx::uri::database() segfaults if no database specified in URL
- Closed