Bugs item #2853383, was opened at 2009-09-07 06:59
Message generated for change (Tracker Item Submitted) made by nobody
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=2853383&group_id=51305

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Nobody/Anonymous (nobody)
Summary: Resource leak in wxsqlite3?

Initial Comment:
Class wxSQLite3Statement (wxsqlite3.cpp) has resource leak in its operator=().
The code does not release m_stmt before assigning new value to one.

wxSQLite3Statement& wxSQLite3Statement::operator=(const wxSQLite3Statement& 
statement)
{
  m_db = statement.m_db;
  m_stmt = statement.m_stmt; // RESOURCE LEAK, must be called 
sqlite3_finalize(m_stmt) first!!!
  // Only one object can own prepared statement
  const_cast<wxSQLite3Statement&>(statement).m_stmt = 0;
  return *this;
}


Take a look at similar right code.

wxSQLite3ResultSet& wxSQLite3ResultSet::operator=(const wxSQLite3ResultSet& 
resultSet)
{
  try
  {
    Finalize(); // free m_stmt if owns
  }
  catch (...)
  {
  }
  m_stmt = resultSet.m_stmt;
  // Only one object can own the statement
  const_cast<wxSQLite3ResultSet&>(resultSet).m_stmt = 0;
  m_eof = resultSet.m_eof;
  m_first = resultSet.m_first;
  m_cols = resultSet.m_cols;
  m_ownStmt = resultSet.m_ownStmt;
  return *this;
}


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=462816&aid=2853383&group_id=51305

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
wxCode-users mailing list
wxCode-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxcode-users

Reply via email to