From ecc247d56dae1858e0d3239f9f28095dfce833af Mon Sep 17 00:00:00 2001 From: Eric House Date: Fri, 10 Nov 2017 20:30:25 -0800 Subject: [PATCH] fix a couple of obvious bugs --- xwords4/linux/gamesdb.c | 5 +++-- xwords4/linux/relaycon.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/xwords4/linux/gamesdb.c b/xwords4/linux/gamesdb.c index fd968a22b..377a0dac0 100644 --- a/xwords4/linux/gamesdb.c +++ b/xwords4/linux/gamesdb.c @@ -129,13 +129,14 @@ writeBlobColumnData( const XP_U8* data, gsize len, XP_U16 strVersion, sqlite3* p assertPrintResult( pDb, result, SQLITE_OK ); result = sqlite3_blob_close( blob ); assertPrintResult( pDb, result, SQLITE_OK ); + if ( !!stmt ) { sqlite3_finalize( stmt ); } LOG_RETURNF( "%lld", curRow ); return curRow; -} +} /* writeBlobColumnData */ static sqlite3_int64 writeBlobColumnStream( XWStreamCtxt* stream, sqlite3* pDb, sqlite3_int64 curRow, @@ -326,7 +327,7 @@ getRelayIDsToRowsMap( sqlite3* pDb ) XP_UCHAR relayID[32]; getColumnText( ppStmt, 0, relayID, VSIZE(relayID) ); gpointer key = g_strdup( relayID ); - sqlite3_int64* value = g_malloc( sizeof( *key ) ); + sqlite3_int64* value = g_malloc( sizeof( value ) ); *value = sqlite3_column_int64( ppStmt, 1 ); g_hash_table_insert( table, key, value ); /* XP_LOGF( "%s(): added map %s => %lld", __func__, (char*)key, *value ); */ diff --git a/xwords4/linux/relaycon.c b/xwords4/linux/relaycon.c index 707c20756..d5bad5e81 100644 --- a/xwords4/linux/relaycon.c +++ b/xwords4/linux/relaycon.c @@ -152,7 +152,7 @@ addJsonParams( CURL* curl, va_list ap ) json_object* param = va_arg(ap, json_object*); XP_ASSERT( !!param ); - const char* asStr = json_object_to_json_string( param ); + const char* asStr = json_object_get_string( param ); XP_LOGF( "%s: adding param (with name %s): %s", __func__, name, asStr ); char* curl_params = curl_easy_escape( curl, asStr, strlen(asStr) );