summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2024-09-25 01:33:47 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2024-09-25 01:33:47 -0400
commit9af325a541ecbf430624ed3bdee95fa88a55078e (patch)
tree34503c44c45932ae9fd0b3058b0e8f04c3cfd89d
parenta0e95c888d84bf20c73e7b1e8a274749b1bcdc94 (diff)
downloadrockbox-9af325a541.tar.gz
rockbox-9af325a541.zip
[BugFix] tagcache_search() must be closed with tagcache_search_finish()
fix a couple of places where this could be left open Change-Id: I43ac7d6b26d728c11f96e5415710341d60f07ab8
-rw-r--r--apps/plugins/pictureflow/pictureflow.c3
-rw-r--r--apps/tagcache.c4
2 files changed, 7 insertions, 0 deletions
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;
}
}