Explicitly close cursors we open despite knowing they'll be closed with the session later.

This commit is contained in:
Gregory Burd 2013-04-16 17:15:23 -04:00
parent 3dab6a2dc5
commit 2d077a0baf

View file

@ -134,9 +134,10 @@ __close_all_sessions(WterlConnHandle *conn_handle)
khiter_t itr; khiter_t itr;
for (itr = kh_begin(h); itr != kh_end(h); ++itr) { for (itr = kh_begin(h); itr != kh_end(h); ++itr) {
if (kh_exist(h, itr)) { if (kh_exist(h, itr)) {
// WT_CURSOR *cursor = kh_val(h, itr); WT_CURSOR *cursor = kh_val(h, itr);
// cursor->close(cursor);
char *key = (char *)kh_key(h, itr); char *key = (char *)kh_key(h, itr);
cursor->close(cursor);
kh_del(cursors, h, itr);
enif_free(key); enif_free(key);
} }
} }
@ -287,6 +288,10 @@ ASYNC_NIF_DECL(
int rc = wiredtiger_open(args->homedir, NULL, config.data[0] != 0 ? (const char*)config.data : NULL, &conn); int rc = wiredtiger_open(args->homedir, NULL, config.data[0] != 0 ? (const char*)config.data : NULL, &conn);
if (rc == 0) { if (rc == 0) {
WterlConnHandle *conn_handle = enif_alloc_resource(wterl_conn_RESOURCE, sizeof(WterlConnHandle)); WterlConnHandle *conn_handle = enif_alloc_resource(wterl_conn_RESOURCE, sizeof(WterlConnHandle));
if (!conn_handle) {
ASYNC_NIF_REPLY(__strerror_term(env, ENOMEM));
return;
}
if (session_config.size > 1) { if (session_config.size > 1) {
char *sc = enif_alloc(session_config.size); char *sc = enif_alloc(session_config.size);
if (!sc) { if (!sc) {