Author: wyoung
Date: Sun Jun 1 12:04:23 2014
New Revision: 2768
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2768&view=rev
Log:
The DBDriver::operator= would leak a live connection if you assigned a
disconnected DBDriver to it. Patch by Quentin Armitage
<[email protected]>
Modified:
trunk/lib/dbdriver.cpp
Modified: trunk/lib/dbdriver.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/dbdriver.cpp?rev=2768&r1=2767&r2=2768&view=diff
==============================================================================
--- trunk/lib/dbdriver.cpp (original)
+++ trunk/lib/dbdriver.cpp Sun Jun 1 12:04:23 2014
@@ -127,11 +127,12 @@
void
DBDriver::copy(const DBDriver& other)
{
+ if (connected()) {
+ disconnect();
+ }
+
if (other.connected()) {
connect(other.mysql_);
- }
- else {
- is_connected_ = false;
}
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits