[CDRIVER-2051] Documentation for several mongoc_uri_*() methods which return pointer types fail to state that NULL can be returned Created: 13/Feb/17  Updated: 19/Jul/19  Resolved: 20/Jun/19

Status: Closed
Project: C Driver
Component/s: docs, libmongoc
Affects Version/s: None
Fix Version/s: 1.15.0

Type: Improvement Priority: Major - P3
Reporter: J Rassi Assignee: Isabel Atkinson
Resolution: Done Votes: 0
Labels: neweng
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to CXX-1187 mongocxx::uri::database() segfaults i... Closed

 Description   

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()


 Comments   
Comment by Jeremy Mikola [ 19/Jul/19 ]

Commit: https://github.com/mongodb/mongo-c-driver/commit/d5a9ac7ef68312aac7b454f90c42ecf2f852648b

Generated at Wed Feb 07 21:14:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.