In __reg_val() in case the 'if (per_port && tdport)' condition is
true, we leak the previously allocated char *subpath.
Instead jump to 'errorout' which frees it, just like the other error
paths do in this function.
Signed-off-by: Michele Baldessari <michele(a)acksyn.org>
---
teamd/teamd_state.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/teamd/teamd_state.c b/teamd/teamd_state.c
index 6191ea123954..ddfd85505e52 100644
--- a/teamd/teamd_state.c
+++ b/teamd/teamd_state.c
@@ -98,8 +98,10 @@ int __reg_val(struct teamd_context *ctx, const struct teamd_state_val *val,
}
if (val->per_port)
per_port = true;
- if (per_port && tdport)
- return -EINVAL;
+ if (per_port && tdport) {
+ err = -EINVAL;
+ goto errout;
+ }
if (val->type == TEAMD_STATE_ITEM_TYPE_NODE) {
int i;
--
1.8.5.3