From: Flole998 Date: Thu, 27 Oct 2022 20:01:31 +0000 (+0200) Subject: Fix race condition/data corruption in imagecache X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=185013382c1d9a2aee8425746b65b7415802fc29;p=thirdparty%2Ftvheadend.git Fix race condition/data corruption in imagecache --- diff --git a/src/imagecache.c b/src/imagecache.c index 7a93d6791..67d0a937e 100644 --- a/src/imagecache.c +++ b/src/imagecache.c @@ -573,8 +573,8 @@ imagecache_done ( void ) } imagecache_destroy(img, 0); } - tvh_mutex_unlock(&imagecache_lock); SKEL_FREE(imagecache_skel); + tvh_mutex_unlock(&imagecache_lock); } @@ -680,12 +680,12 @@ imagecache_get_id ( const char *url ) if (!imagecache_conf.enabled && strncasecmp(url, "file://", 7)) return 0; + tvh_mutex_lock(&imagecache_lock); + /* Skeleton */ SKEL_ALLOC(imagecache_skel); imagecache_skel->url = url; - tvh_mutex_lock(&imagecache_lock); - /* Create/Find */ i = RB_INSERT_SORTED(&imagecache_by_url, imagecache_skel, url_link, url_cmp); if (!i) {