author | brad <brad> | 2004-04-06 11:58:24 (UTC) |
---|---|---|
committer | brad <brad> | 2004-04-06 11:58:24 (UTC) |
commit | 74c9cbe70b2a2530aad5e5a3cc8e0c946c560e95 (patch) (side-by-side diff) | |
tree | af55d362e359414b2b18cef0c979d7e71e6a7d96 | |
parent | 52b7f68dd9435286a2d0b53fc8649b4323b8af38 (diff) | |
download | opie-74c9cbe70b2a2530aad5e5a3cc8e0c946c560e95.zip opie-74c9cbe70b2a2530aad5e5a3cc8e0c946c560e95.tar.gz opie-74c9cbe70b2a2530aad5e5a3cc8e0c946c560e95.tar.bz2 |
Fix memleak
-rw-r--r-- | libopie2/opiedb/osqlitedriver.cpp | 9 | ||||
-rw-r--r-- | libopie2/opiedb/osqlitedriver.h | 2 |
2 files changed, 5 insertions, 6 deletions
diff --git a/libopie2/opiedb/osqlitedriver.cpp b/libopie2/opiedb/osqlitedriver.cpp index f07d520..3ba161e 100644 --- a/libopie2/opiedb/osqlitedriver.cpp +++ b/libopie2/opiedb/osqlitedriver.cpp @@ -136,7 +136,6 @@ bool OSQLiteDriver::open() { free( error ); return false; } - sqreg = (sqregex *)malloc(sizeof(sqreg)); sqlite_create_function(m_sqlite,"rlike",3,rlikeFunc,&sqreg); return true; } @@ -149,10 +148,10 @@ bool OSQLiteDriver::open() { bool OSQLiteDriver::close() { if (m_sqlite ) sqlite_close( m_sqlite ), m_sqlite=0l; - if (sqreg->regex_raw != NULL){ - free(sqreg->regex_raw); - sqreg->regex_raw=NULL; - regfree(&sqreg->regex_c); + if (sqreg.regex_raw != NULL){ + free(sqreg.regex_raw); + sqreg.regex_raw=NULL; + regfree(&sqreg.regex_c); } return true; } diff --git a/libopie2/opiedb/osqlitedriver.h b/libopie2/opiedb/osqlitedriver.h index 95c9e2f..adec331 100644 --- a/libopie2/opiedb/osqlitedriver.h +++ b/libopie2/opiedb/osqlitedriver.h @@ -41,7 +41,7 @@ private: static int call_back( void*, int, char**, char** ); QString m_url; sqlite *m_sqlite; - sqregex *sqreg; + sqregex sqreg; }; } } |