summaryrefslogtreecommitdiff
path: root/libopie2
authorbrad <brad>2004-04-06 11:58:24 (UTC)
committer brad <brad>2004-04-06 11:58:24 (UTC)
commit74c9cbe70b2a2530aad5e5a3cc8e0c946c560e95 (patch) (unidiff)
treeaf55d362e359414b2b18cef0c979d7e71e6a7d96 /libopie2
parent52b7f68dd9435286a2d0b53fc8649b4323b8af38 (diff)
downloadopie-74c9cbe70b2a2530aad5e5a3cc8e0c946c560e95.zip
opie-74c9cbe70b2a2530aad5e5a3cc8e0c946c560e95.tar.gz
opie-74c9cbe70b2a2530aad5e5a3cc8e0c946c560e95.tar.bz2
Fix memleak
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiedb/osqlitedriver.cpp9
-rw-r--r--libopie2/opiedb/osqlitedriver.h2
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() {
136 free( error ); 136 free( error );
137 return false; 137 return false;
138 } 138 }
139 sqreg = (sqregex *)malloc(sizeof(sqreg));
140 sqlite_create_function(m_sqlite,"rlike",3,rlikeFunc,&sqreg); 139 sqlite_create_function(m_sqlite,"rlike",3,rlikeFunc,&sqreg);
141 return true; 140 return true;
142} 141}
@@ -149,10 +148,10 @@ bool OSQLiteDriver::open() {
149bool OSQLiteDriver::close() { 148bool OSQLiteDriver::close() {
150 if (m_sqlite ) 149 if (m_sqlite )
151 sqlite_close( m_sqlite ), m_sqlite=0l; 150 sqlite_close( m_sqlite ), m_sqlite=0l;
152 if (sqreg->regex_raw != NULL){ 151 if (sqreg.regex_raw != NULL){
153 free(sqreg->regex_raw); 152 free(sqreg.regex_raw);
154 sqreg->regex_raw=NULL; 153 sqreg.regex_raw=NULL;
155 regfree(&sqreg->regex_c); 154 regfree(&sqreg.regex_c);
156 } 155 }
157 return true; 156 return true;
158} 157}
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:
41 static int call_back( void*, int, char**, char** ); 41 static int call_back( void*, int, char**, char** );
42 QString m_url; 42 QString m_url;
43 sqlite *m_sqlite; 43 sqlite *m_sqlite;
44 sqregex *sqreg; 44 sqregex sqreg;
45}; 45};
46} 46}
47} 47}