From 69db103a38731e33db98f08622e7c91a8ce8df10 Mon Sep 17 00:00:00 2001 From: Andreas Baumann Date: Wed, 15 Sep 2010 06:10:32 +0200 Subject: fixed a memory leak per row in the quey buffer --- src/result.cpp | 4 ++-- 1 file 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; } } -- cgit v1.2.3-54-g00ecf