Skip to content

Commit

Permalink
Acquire statement lock before finalizing
Browse files Browse the repository at this point in the history
  • Loading branch information
warmwaffles committed Jan 20, 2025
1 parent 41a7ad9 commit 8fdf22b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions c_src/sqlite3_nif.c
Original file line number Diff line number Diff line change
Expand Up @@ -1087,16 +1087,16 @@ statement_type_destructor(ErlNifEnv* env, void* arg)
assert(arg);

statement_t* statement = (statement_t*)arg;
statement_acquire_lock(statement);

if (statement->statement) {
sqlite3_finalize(statement->statement);
statement->statement = NULL;
}

if (statement->conn) {
enif_release_resource(statement->conn);
statement->conn = NULL;
}
statement_release_lock(statement);
enif_release_resource(statement->conn);
statement->conn = NULL;
}

int
Expand Down

0 comments on commit 8fdf22b

Please sign in to comment.