Skip to content

Commit c24addf

Browse files
committed
Merge branch 'v1.5'
2 parents a79002d + d3ce76f commit c24addf

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/MongoDB/Session.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,14 @@ zend_class_entry* php_phongo_session_ce;
4040

4141
static bool php_phongo_topology_is_sharded_cluster(mongoc_client_t* client)
4242
{
43-
mongoc_server_description_t* sd = mongoc_client_select_server(client, true, NULL, NULL);
43+
mongoc_server_description_t* sd;
44+
bool ret;
4445

45-
return (sd && !strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_MONGOS].name));
46+
sd = mongoc_client_select_server(client, true, NULL, NULL);
47+
ret = (sd && !strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_MONGOS].name));
48+
mongoc_server_description_destroy(sd);
49+
50+
return ret;
4651
}
4752

4853
static bool php_phongo_session_get_timestamp_parts(zval* obj, uint32_t* timestamp, uint32_t* increment TSRMLS_DC)

0 commit comments

Comments
 (0)