Author: wyoung
Date: Thu Dec 12 16:17:07 2013
New Revision: 2760
URL: http://svn.gna.org/viewcvs/mysqlpp?rev=2760&view=rev
Log:
Plugged a potential DBDriver instance leak in Connection ctor.
Patch by Yury Alekseev <[email protected]>.
Modified:
trunk/lib/connection.cpp
Modified: trunk/lib/connection.cpp
URL:
http://svn.gna.org/viewcvs/mysqlpp/trunk/lib/connection.cpp?rev=2760&r1=2759&r2=2760&view=diff
==============================================================================
--- trunk/lib/connection.cpp (original)
+++ trunk/lib/connection.cpp Thu Dec 12 16:17:07 2013
@@ -49,7 +49,15 @@
driver_(new DBDriver()),
copacetic_(true)
{
- connect(db, server, user, password, port);
+ try {
+ connect(db, server, user, password, port);
+ }
+ catch (...) {
+ // Exception thrown from ctor causes dtor to not be called, so
+ // we have to delete the DBDriver instance, else we'll leak it.
+ delete driver_;
+ throw;
+ }
}
_______________________________________________
Mysqlpp-commits mailing list
[email protected]
https://mail.gna.org/listinfo/mysqlpp-commits