summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2010-09-15 06:10:32 +0200
committerAndreas Baumann <abaumann@yahoo.com>2010-09-15 06:10:32 +0200
commit69db103a38731e33db98f08622e7c91a8ce8df10 (patch)
tree65122ce855038ff7b0023bafab25d06fa8715a0f
parentf0ce88e605b3717d50a7c153aa9b00c002b24805 (diff)
downloadsqlitexx-69db103a38731e33db98f08622e7c91a8ce8df10.tar.gz
sqlitexx-69db103a38731e33db98f08622e7c91a8ce8df10.tar.bz2
fixed a memory leak per row in the quey buffer
-rw-r--r--src/result.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/result.cpp b/src/result.cpp
index 0e8aa89..93a8948 100644
--- a/src/result.cpp
+++ b/src/result.cpp
@@ -111,7 +111,7 @@ void result::BufferData( ) {
_cache.resize( columns( ) + 1 );
for( size_type i = 0; i < columns( ); i++ ) {
- CachedValue value;
+ CachedValue &value = _cache.at( i );
value.type = column_type( i );
switch( value.type ) {
case SQLITE_INTEGER:
@@ -125,6 +125,7 @@ void result::BufferData( ) {
*/
tmp = (const char *)sqlite3_column_text( _stmt, i );
if( tmp != NULL ) {
+ if( value.value.s != NULL ) free( value.value.s );
value.value.s = (unsigned char *)strdup( tmp );
} else {
value.type = SQLITE_NULL;
@@ -147,7 +148,6 @@ void result::BufferData( ) {
throw logic_error( msg );
}
}
- _cache.at( i ) = value;
}
}