mirror of
https://github.com/torvalds/linux.git
synced 2026-07-31 11:37:06 +02:00
regulator: rpmh-regulator: fix rpmh_regulator_init_vreg_supply memory leak
Commit 29c41d5c47cb ("regulator: rpmh-regulator: support parent
supply specification in subnodes") introduced a memory leak in
the function rpmh_regulator_init_vreg_supply() due to 'buf' not
being freed in the new 'else if' statement. Fix this memory leak
by freeing 'buf' correctly.
Change-Id: If2748b595d8ae3a4564a2956a67aeda476975309
Signed-off-by: David Collins <collinsd@codeaurora.org>
This commit is contained in:
parent
442fbd3fa6
commit
507aaefcf7
|
|
@ -1,5 +1,5 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */
|
||||
/* Copyright (c) 2016-2021, The Linux Foundation. All rights reserved. */
|
||||
|
||||
#define pr_fmt(fmt) "%s: " fmt, __func__
|
||||
|
||||
|
|
@ -1673,6 +1673,7 @@ static int rpmh_regulator_init_vreg_supply(struct rpmh_vreg *vreg)
|
|||
|
||||
vreg->rdesc.supply_name = buf;
|
||||
} else if (of_find_property(vreg->of_node, "vin-supply", NULL)) {
|
||||
kfree(buf);
|
||||
vreg->rdesc.supply_name = "vin";
|
||||
} else {
|
||||
kfree(buf);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user