MT#61856 media_player: add cached file func, name ownership issue

The `name` is caller-owned, while the cache itself
also keeps a separate key object
in the `media_player_media_files_names`.
This can desynchronize the hash key and the list key.

Hence prefer using the owned key instead.

Change-Id: I9b85c306cc4e2c32675bada3dec0d049ff5645fe
mr26.1
Donat Zenichev 3 weeks ago
parent b04cf1202c
commit 7a4feef1ff

@ -2316,8 +2316,9 @@ bool media_player_add_cached_file(str *name) {
LOCK(&media_player_media_files_lock);
__auto_type foold = t_hash_table_lookup(media_player_media_files, name);
if (foold) {
str *key = foold->str_link->data;
fonew->str_link = foold->str_link;
t_hash_table_replace(media_player_media_files, name, fonew);
t_hash_table_replace(media_player_media_files, key, fonew);
obj_put(foold);
}
else

Loading…
Cancel
Save