From 1a397ca79b71ef0bb4d789d296b89a87a2da06d3 Mon Sep 17 00:00:00 2001 From: Julien BLACHE Date: Sun, 22 Nov 2009 12:30:29 +0100 Subject: [PATCH] Check that db_pl_fetch_byquery only gets 1 query result --- src/db.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/db.c b/src/db.c index d69d2180..00c848ea 100644 --- a/src/db.c +++ b/src/db.c @@ -1644,8 +1644,17 @@ db_pl_fetch_byquery(char *query) } } + ret = sqlite3_step(stmt); sqlite3_finalize(stmt); + if (ret != SQLITE_DONE) + { + DPRINTF(E_WARN, L_DB, "Query had more than a single result!\n"); + + free_pli(pli, 0); + return NULL; + } + /* Playlist 1: all files */ if (pli->id == 1) pli->items = db_files_get_count();