Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## (unreleased)

* Add Ruby 3.0 to the cross compile list
* Fix segfault when asking if client was dead after closing it. Fixes #519.

## 2.1.5

Expand Down
2 changes: 2 additions & 0 deletions ext/tiny_tds/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ static void rb_tinytds_client_free(void *ptr) {
dbloginfree(cwrap->login);
if (cwrap->client && !cwrap->closed) {
dbclose(cwrap->client);
cwrap->client = NULL;
cwrap->closed = 1;
cwrap->userdata->closed = 1;
}
Expand Down Expand Up @@ -263,6 +264,7 @@ static VALUE rb_tinytds_close(VALUE self) {
GET_CLIENT_WRAPPER(self);
if (cwrap->client && !cwrap->closed) {
dbclose(cwrap->client);
cwrap->client = NULL;
cwrap->closed = 1;
cwrap->userdata->closed = 1;
}
Expand Down
1 change: 1 addition & 0 deletions test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ClientTest < TinyTds::TestCase
assert @client.close
assert @client.closed?
assert [email protected]?
assert @client.dead?
action = lambda { @client.execute('SELECT 1 as [one]').each }
assert_raise_tinytds_error(action) do |e|
assert_match %r{closed connection}i, e.message, 'ignore if non-english test run'
Expand Down