Skip to content

Commit fa02408

Browse files
committed
CDRIVER-526 memory leak in get_database_names()
Fix a memory leak in mongoc_client_get_database_names()
1 parent 84c0ec1 commit fa02408

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/mongoc/mongoc-client.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,6 @@ mongoc_client_get_database_names (mongoc_client_t *client,
12941294
{
12951295
bson_iter_t iter;
12961296
const char *name;
1297-
bson_t cmd = BSON_INITIALIZER;
12981297
char **ret = NULL;
12991298
int i = 0;
13001299
mongoc_cursor_t *cursor;
@@ -1320,7 +1319,7 @@ mongoc_client_get_database_names (mongoc_client_t *client,
13201319
ret = bson_malloc0 (sizeof (void*));
13211320
}
13221321

1323-
bson_destroy (&cmd);
1322+
mongoc_cursor_destroy (cursor);
13241323

13251324
return ret;
13261325
}

0 commit comments

Comments
 (0)