From 1260f9727f3edda8b5edc823039db06e916d156e Mon Sep 17 00:00:00 2001 From: Martin Piatka Date: Tue, 16 Jul 2024 12:26:05 +0200 Subject: [PATCH] audio/utils: Fix leak Coverity CID 466491 --- src/audio/utils.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/audio/utils.cpp b/src/audio/utils.cpp index c39520cc9..6b489ca05 100644 --- a/src/audio/utils.cpp +++ b/src/audio/utils.cpp @@ -752,6 +752,7 @@ bool parse_channel_map_cfg(struct channel_map *channel_map, const char *cfg){ } if(!isdigit(strchr(item, ':')[1])) { log_msg(LOG_LEVEL_ERROR, "Audio destination channel not entered!\n"); + free(tmp); return false; } int dst = atoi(strchr(item, ':') + 1); @@ -766,15 +767,15 @@ bool parse_channel_map_cfg(struct channel_map *channel_map, const char *cfg){ } } + free(tmp); + tmp = NULL; + if (!channel_map->validate()) { log_msg(LOG_LEVEL_ERROR, "Wrong audio mapping.\n"); return false; } channel_map->compute_contributors(); - free(tmp); - tmp = NULL; - return true; }