From 2e149273e57fc135236807de52cb11545f367f2a Mon Sep 17 00:00:00 2001 From: ejurgensen Date: Mon, 9 Sep 2019 21:38:06 +0200 Subject: [PATCH] [cache] Clear stash if called with called with NULL --- src/cache.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/cache.c b/src/cache.c index 1c15dcc4..d8c277f8 100644 --- a/src/cache.c +++ b/src/cache.c @@ -1218,7 +1218,7 @@ cache_artwork_stash_impl(void *arg, int *retval) cmdarg = arg; - /* Clear current stash */ + // Clear current stash if (g_stash.path) { free(g_stash.path); @@ -1226,6 +1226,13 @@ cache_artwork_stash_impl(void *arg, int *retval) memset(&g_stash, 0, sizeof(struct stash)); } + // If called with no evbuf then we are done, we just needed to clear the stash + if (!cmdarg->evbuf) + { + *retval = 0; + return COMMAND_END; + } + g_stash.size = evbuffer_get_length(cmdarg->evbuf); g_stash.data = malloc(g_stash.size); if (!g_stash.data)