aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/mysql/statement.cxx25
1 files changed, 14 insertions, 11 deletions
diff --git a/odb/mysql/statement.cxx b/odb/mysql/statement.cxx
index afc6656..4b80913 100644
--- a/odb/mysql/statement.cxx
+++ b/odb/mysql/statement.cxx
@@ -183,19 +183,22 @@ namespace odb
statement::
~statement ()
{
+ if (stmt_ != 0)
{
- odb::tracer* t;
- if ((t = conn_.transaction_tracer ()) ||
- (t = conn_.tracer ()) ||
- (t = conn_.database ().tracer ()))
- t->deallocate (conn_, *this);
- }
+ {
+ odb::tracer* t;
+ if ((t = conn_.transaction_tracer ()) ||
+ (t = conn_.tracer ()) ||
+ (t = conn_.database ().tracer ()))
+ t->deallocate (conn_, *this);
+ }
- // Let the connection handle the release of the statement (it
- // may delay the actual freeing if it will mess up the currently
- // active statement).
- //
- conn_.free_stmt_handle (stmt_);
+ // Let the connection handle the release of the statement (it
+ // may delay the actual freeing if it will mess up the currently
+ // active statement).
+ //
+ conn_.free_stmt_handle (stmt_);
+ }
}
const char* statement::