Skip to content

Commit

Permalink
Merge pull request #254 from canella/master
Browse files Browse the repository at this point in the history
Removed memory leak in function mongoc_database_has_collection
  • Loading branch information
ajdavis committed Nov 26, 2015
2 parents ceef394 + e9c97ce commit a556f6b
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/mongoc/mongoc-database.c
Expand Up @@ -708,13 +708,16 @@ mongoc_database_has_collection (mongoc_database_t *database,
BSON_APPEND_UTF8 (&filter, "name", name);

cursor = mongoc_database_find_collections (database, &filter, error);

if (!cursor ||
(error &&
((error->domain != 0) ||
(error->code != 0)))) {

if (!cursor) {
return ret;
}

if (error &&
((error->domain != 0) ||
(error->code != 0))) {
GOTO (cleanup);
}

while (mongoc_cursor_next (cursor, &doc)) {
if (bson_iter_init (&col_iter, doc) &&
Expand Down

0 comments on commit a556f6b

Please sign in to comment.