From e3b0cc76a32240b630e20a3007871c8ef2de00ce Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 25 Mar 2021 17:34:44 +0100 Subject: [PATCH] pulse-server: avoid leaks in error path When reading the properties failes, make sure to free the properties anyway. --- src/modules/module-protocol-pulse/message.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/modules/module-protocol-pulse/message.c b/src/modules/module-protocol-pulse/message.c index e6c7e0a56..4bdbf15d4 100644 --- a/src/modules/module-protocol-pulse/message.c +++ b/src/modules/module-protocol-pulse/message.c @@ -828,12 +828,15 @@ static int message_dump(enum spa_log_level level, struct message *m) { struct pw_properties *props = pw_properties_new(NULL, NULL); const struct spa_dict_item *it; - if ((res = read_props(m, props, false)) < 0) - return res; - pw_log(level, "%u: props: n_items:%u", o, props->dict.n_items); - spa_dict_for_each(it, &props->dict) - pw_log(level, " '%s': '%s'", it->key, it->value); + res = read_props(m, props, false); + if (res >= 0) { + pw_log(level, "%u: props: n_items:%u", o, props->dict.n_items); + spa_dict_for_each(it, &props->dict) + pw_log(level, " '%s': '%s'", it->key, it->value); + } pw_properties_free(props); + if (res < 0) + return res; break; } case TAG_VOLUME: