From 9972df26149028852f5da7840280a1127ec37d5b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 5 May 2026 12:51:55 +0200 Subject: [PATCH] convert: use static string for convertname We only use it for debugging and checking if it's the default converter. --- spa/plugins/audioconvert/audioadapter.c | 5 ++--- spa/plugins/videoconvert/videoadapter.c | 8 +++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index d78342366..f8f05bcda 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -64,7 +64,7 @@ struct impl { struct spa_node *convert; struct spa_hook convert_listener; uint64_t convert_port_flags; - char *convertname; + char convertname[64]; uint32_t n_buffers; struct spa_buffer **buffers; @@ -1996,7 +1996,7 @@ static int load_converter(struct impl *this, const struct spa_dict *info, this->hnd_convert = hnd_convert; this->convert = iface_conv; this->unload_handle = unload_handle; - this->convertname = strdup(factory_name); + snprintf(this->convertname, sizeof(this->convertname), "%s", factory_name); return 0; } @@ -2129,7 +2129,6 @@ static int impl_clear(struct spa_handle *handle) spa_handle_clear(this->hnd_convert); free(this->hnd_convert); } - free(this->convertname); } clear_buffers(this); diff --git a/spa/plugins/videoconvert/videoadapter.c b/spa/plugins/videoconvert/videoadapter.c index 088a807bd..4b4503ce2 100644 --- a/spa/plugins/videoconvert/videoadapter.c +++ b/spa/plugins/videoconvert/videoadapter.c @@ -65,7 +65,7 @@ struct impl { struct spa_node *convert; struct spa_hook convert_listener; uint64_t convert_port_flags; - char *convertname; + char convertname[64]; uint32_t n_buffers; struct spa_buffer **buffers; @@ -1945,7 +1945,7 @@ static int load_converter(struct impl *this, const struct spa_dict *info, this->hnd_convert = hnd_convert; this->convert = iface_conv; - this->convertname = strdup(factory_name); + snprintf(this->convertname, sizeof(this->convertname), "%s", factory_name); return 0; } @@ -1978,10 +1978,8 @@ static int impl_clear(struct spa_handle *handle) spa_hook_remove(&this->follower_listener); spa_node_set_callbacks(this->follower, NULL, NULL); - if (this->hnd_convert) { + if (this->hnd_convert) spa_plugin_loader_unload(this->ploader, this->hnd_convert); - free(this->convertname); - } clear_buffers(this); return 0;