From 9af325a541ecbf430624ed3bdee95fa88a55078e Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Wed, 25 Sep 2024 01:33:47 -0400 Subject: [BugFix] tagcache_search() must be closed with tagcache_search_finish() fix a couple of places where this could be left open Change-Id: I43ac7d6b26d728c11f96e5415710341d60f07ab8 --- apps/plugins/pictureflow/pictureflow.c | 3 +++ apps/tagcache.c | 4 ++++ 2 files changed, 7 insertions(+) (limited to 'apps') diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index e5492cf01c..b68e879fc4 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c @@ -1218,7 +1218,10 @@ static int create_album_untagged(struct tagcache_search *tcs, { if (rb->button_get(false) > BUTTON_NONE) { if (confirm_quit()) + { + rb->tagcache_search_finish(tcs); return ERROR_USER_ABORT; + } else { rb->lcd_clear_display(); diff --git a/apps/tagcache.c b/apps/tagcache.c index 5bfeb82481..7d8d2aec22 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c @@ -970,6 +970,7 @@ static int find_index(const char *filename) bool tagcache_find_index(struct tagcache_search *tcs, const char *filename) { + /* NOTE: on ret==true you need to call tagcache_search_finish(tcs) yourself */ int idx_id; if (!tc_stat.ready) @@ -1721,6 +1722,7 @@ static bool build_lookup_list(struct tagcache_search *tcs) bool tagcache_search(struct tagcache_search *tcs, int tag) { + /* NOTE: call tagcache_search_finish(&tcs) when finished or BAD things may happen (TM) */ struct tagcache_header tag_hdr; struct master_header master_hdr; int i; @@ -3936,6 +3938,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) if (clfd < 0) { logf("failure to open changelog"); + tagcache_search_finish(tcs); return false; } @@ -3944,6 +3947,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) if ( (tcs->masterfd = open_master_fd(&myhdr, false)) < 0) { close(clfd); + tagcache_search_finish(tcs); return false; } } -- cgit v1.2.3