Navigation Menu

Skip to content

Commit

Permalink
grn_db_create(): add missing CRITICAL_SECTION_FIN() call on error
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Oct 8, 2015
1 parent 38786f5 commit 12d4bf1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/db.c
Expand Up @@ -192,6 +192,7 @@ grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg)
goto exit;
}

CRITICAL_SECTION_INIT(s->lock);
grn_tiny_array_init(ctx, &s->values, sizeof(db_value),
GRN_TINY_ARRAY_CLEAR|
GRN_TINY_ARRAY_THREADSAFE|
Expand Down Expand Up @@ -227,7 +228,6 @@ grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg)
goto exit;
}

CRITICAL_SECTION_INIT(s->lock);
GRN_DB_OBJ_SET_TYPE(s, GRN_DB);
s->obj.db = (grn_obj *)s;
s->obj.header.domain = GRN_ID_NIL;
Expand Down Expand Up @@ -265,6 +265,7 @@ grn_db_create(grn_ctx *ctx, const char *path, grn_db_create_optarg *optarg)
}
}
grn_tiny_array_fin(&s->values);
CRITICAL_SECTION_FIN(s->lock);
GRN_FREE(s);
}

Expand Down

0 comments on commit 12d4bf1

Please sign in to comment.