diff options
author | William Wilgus <wilgus.william@gmail.com> | 2024-09-25 01:33:47 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2024-09-25 01:33:47 -0400 |
commit | 9af325a541ecbf430624ed3bdee95fa88a55078e (patch) | |
tree | 34503c44c45932ae9fd0b3058b0e8f04c3cfd89d /apps/tagcache.c | |
parent | a0e95c888d84bf20c73e7b1e8a274749b1bcdc94 (diff) | |
download | rockbox-9af325a541ecbf430624ed3bdee95fa88a55078e.tar.gz rockbox-9af325a541ecbf430624ed3bdee95fa88a55078e.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
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r-- | apps/tagcache.c | 4 |
1 files changed, 4 insertions, 0 deletions
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) | |||
970 | 970 | ||
971 | bool tagcache_find_index(struct tagcache_search *tcs, const char *filename) | 971 | bool tagcache_find_index(struct tagcache_search *tcs, const char *filename) |
972 | { | 972 | { |
973 | /* NOTE: on ret==true you need to call tagcache_search_finish(tcs) yourself */ | ||
973 | int idx_id; | 974 | int idx_id; |
974 | 975 | ||
975 | if (!tc_stat.ready) | 976 | if (!tc_stat.ready) |
@@ -1721,6 +1722,7 @@ static bool build_lookup_list(struct tagcache_search *tcs) | |||
1721 | 1722 | ||
1722 | bool tagcache_search(struct tagcache_search *tcs, int tag) | 1723 | bool tagcache_search(struct tagcache_search *tcs, int tag) |
1723 | { | 1724 | { |
1725 | /* NOTE: call tagcache_search_finish(&tcs) when finished or BAD things may happen (TM) */ | ||
1724 | struct tagcache_header tag_hdr; | 1726 | struct tagcache_header tag_hdr; |
1725 | struct master_header master_hdr; | 1727 | struct master_header master_hdr; |
1726 | int i; | 1728 | int i; |
@@ -3936,6 +3938,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) | |||
3936 | if (clfd < 0) | 3938 | if (clfd < 0) |
3937 | { | 3939 | { |
3938 | logf("failure to open changelog"); | 3940 | logf("failure to open changelog"); |
3941 | tagcache_search_finish(tcs); | ||
3939 | return false; | 3942 | return false; |
3940 | } | 3943 | } |
3941 | 3944 | ||
@@ -3944,6 +3947,7 @@ bool tagcache_create_changelog(struct tagcache_search *tcs) | |||
3944 | if ( (tcs->masterfd = open_master_fd(&myhdr, false)) < 0) | 3947 | if ( (tcs->masterfd = open_master_fd(&myhdr, false)) < 0) |
3945 | { | 3948 | { |
3946 | close(clfd); | 3949 | close(clfd); |
3950 | tagcache_search_finish(tcs); | ||
3947 | return false; | 3951 | return false; |
3948 | } | 3952 | } |
3949 | } | 3953 | } |