[db] Fix memleak from unexpected return value, closes issue #909

On success the function was returning SQLITE_OK = 100, not 0, which made
json_reply_library think that the operation failed.

Credit @whatdoineed2do
This commit is contained in:
ejurgensen 2020-02-25 21:58:18 +01:00
parent 248f82f3c8
commit 64c6007aad

View File

@ -4415,7 +4415,9 @@ admin_get(void *value, const char *key, short type)
default: default:
DPRINTF(E_LOG, L_DB, "BUG: Unknown type %d in admin_set\n", type); DPRINTF(E_LOG, L_DB, "BUG: Unknown type %d in admin_set\n", type);
ret = -2; sqlite3_finalize(stmt);
sqlite3_free(query);
return -1;
} }
#ifdef DB_PROFILE #ifdef DB_PROFILE
@ -4426,7 +4428,7 @@ admin_get(void *value, const char *key, short type)
sqlite3_finalize(stmt); sqlite3_finalize(stmt);
sqlite3_free(query); sqlite3_free(query);
return ret; return 0;
#undef Q_TMPL #undef Q_TMPL
} }