From 7a4feef1ffdc44e6ff84e85bd2c3bed865164f5a Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Tue, 26 May 2026 17:48:49 +0200 Subject: [PATCH] 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 --- daemon/media_player.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemon/media_player.c b/daemon/media_player.c index f7a9c680b..274347184 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -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