Skip to content

Commit d3ce76f

Browse files
committed
Merge pull request #992
2 parents 66d667d + 88d783a commit d3ce76f

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
@@ -37,9 +37,14 @@ zend_class_entry* php_phongo_session_ce;
3737

3838
static bool php_phongo_topology_is_sharded_cluster(mongoc_client_t* client)
3939
{
40-
mongoc_server_description_t* sd = mongoc_client_select_server(client, true, NULL, NULL);
40+
mongoc_server_description_t* sd;
41+
bool ret;
4142

42-
return (sd && !strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_MONGOS].name));
43+
sd = mongoc_client_select_server(client, true, NULL, NULL);
44+
ret = (sd && !strcmp(mongoc_server_description_type(sd), php_phongo_server_description_type_map[PHONGO_SERVER_MONGOS].name));
45+
mongoc_server_description_destroy(sd);
46+
47+
return ret;
4348
}
4449

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

0 commit comments

Comments
 (0)