commit | 39ca9d50c26f622640bdca0b0f5a23543b6d9788 | [log] [tgz] |
---|---|---|
author | kevinpoitra <pupkevin@gmail.com> | Tue Apr 14 04:35:54 2020 -0500 |
committer | Georg Semmler <georg_semmler_05@web.de> | Thu Apr 16 10:10:53 2020 +0200 |
tree | 5178b963ce4ee7d17270205c2f6547c319134905 | |
parent | 4847ecfd3ba47f804c48812b38babda4b8e78c97 [diff] |
Properly call PQFinish after failed connection attempts to stop leaking socket file descriptors
diff --git a/diesel/src/pg/connection/raw.rs b/diesel/src/pg/connection/raw.rs index 98eb4f9..a57cde2 100644 --- a/diesel/src/pg/connection/raw.rs +++ b/diesel/src/pg/connection/raw.rs
@@ -32,6 +32,9 @@ } _ => { let message = last_error_message(connection_ptr); + + unsafe { PQfinish(connection_ptr) } + Err(ConnectionError::BadConnection(message)) } }