Closed bakcsizs closed 3 years ago
Yes, you are right. Method wxSQLite3Database::GetTable can leak memory in case of an error. Thanks for reporting.
Your proposed fix is indeed correct. And at several places in wxSQLite3 memory retrieved from SQLite is freed in that way. Maybe this issue went undetected for such a long time, because the GetTable interface is not used very often. In fact, its usage is strongly discouraged.
Yes, I was wondering myself why this wasn't noticed yet. Thanks for the explanation!
Hello,
For each wxSQLite3Database::Interrupt() call, I get a memory leak with content "interrupted". As far as I could debug, it happens because in wxSQLite3Database::GetTable(), localError is not freed. Replacing
throw wxSQLite3Exception(rc, wxString::FromUTF8(localError));
withconst wxString err = wxString::FromUTF8(localError); sqlite3_free(localError); throw wxSQLite3Exception(rc, err);
seems to solve the problem. But I'm not a wxsqlite3-insider, so I'm not sure this is the right solution. Thanks! Zsolt