Documentation formongoc_client_session_get_opts should clarify that the returned pointer is only valid for the lifetime of the client session. Additionally, we can advise users about mongoc_session_opts_clone() and mongoc_session_opts_destroy() if they would like a permanent copy not bound to the lifetime of the session object.
I know this is done in a few places for other get methods in libmongoc, but I'm not sure if this instance was intentional or simply an oversight.