Commit bac853a1 authored by Simon Morlat's avatar Simon Morlat

fix memory leaks

parent 3735b881
...@@ -95,6 +95,7 @@ int bzrtp_initCache(void *dbPointer) { ...@@ -95,6 +95,7 @@ int bzrtp_initCache(void *dbPointer) {
/* get current db schema version (user_version pragma in sqlite )*/ /* get current db schema version (user_version pragma in sqlite )*/
sql = sqlite3_mprintf("PRAGMA user_version;"); sql = sqlite3_mprintf("PRAGMA user_version;");
ret = sqlite3_exec(db, sql, callback_getUserVersion, &userVersion, &errmsg); ret = sqlite3_exec(db, sql, callback_getUserVersion, &userVersion, &errmsg);
sqlite3_free(sql);
if (ret!=SQLITE_OK) { if (ret!=SQLITE_OK) {
sqlite3_free(errmsg); sqlite3_free(errmsg);
return BZRTP_ZIDCACHE_UNABLETOREAD; return BZRTP_ZIDCACHE_UNABLETOREAD;
...@@ -108,6 +109,7 @@ int bzrtp_initCache(void *dbPointer) { ...@@ -108,6 +109,7 @@ int bzrtp_initCache(void *dbPointer) {
/* update the schema version in DB metadata */ /* update the schema version in DB metadata */
sql = sqlite3_mprintf("PRAGMA user_version = %d;",ZIDCACHE_DBSCHEMA_VERSION_NUMBER); sql = sqlite3_mprintf("PRAGMA user_version = %d;",ZIDCACHE_DBSCHEMA_VERSION_NUMBER);
ret = sqlite3_prepare(db, sql, -1, &stmt, NULL); ret = sqlite3_prepare(db, sql, -1, &stmt, NULL);
sqlite3_free(sql);
if (ret != SQLITE_OK) { if (ret != SQLITE_OK) {
return BZRTP_ZIDCACHE_UNABLETOUPDATE; return BZRTP_ZIDCACHE_UNABLETOUPDATE;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment