[1/1] examples/vm_power_manager: fix resource leak
diff mbox series

Message ID 20200729083754.1044630-1-rory.sexton@intel.com
State New
Delegated to: Thomas Monjalon
Headers show
Series
  • [1/1] examples/vm_power_manager: fix resource leak
Related show

Checks

Context Check Description
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/travis-robot success Travis build: passed
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Rory Sexton July 29, 2020, 8:37 a.m. UTC
Fix memory leak where variable oob_enable can go out of scope leaking
the storage it points to.

Coverity issue: 337674
Fixes: 95f648ff9ee ("examples/vm_power: make branch ratio threshold per core")

Signed-off-by: Rory Sexton <rory.sexton@intel.com>
---
 examples/vm_power_manager/main.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Hunt Sept. 18, 2020, 8:13 a.m. UTC | #1
Hi Rory,

On 29/7/2020 9:37 AM, Rory Sexton wrote:
> Fix memory leak where variable oob_enable can go out of scope leaking
> the storage it points to.
>
> Coverity issue: 337674
> Fixes: 95f648ff9ee ("examples/vm_power: make branch ratio threshold per core")
>
> Signed-off-by: Rory Sexton <rory.sexton@intel.com>
> ---
>   examples/vm_power_manager/main.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
> index 77797b1e1..0242cca1a 100644
> --- a/examples/vm_power_manager/main.c
> +++ b/examples/vm_power_manager/main.c
> @@ -209,6 +209,7 @@ parse_args(int argc, char **argv)
>   			}
>   			if (branch_ratio <= 0.0 || branch_ratio > 100.0) {
>   				printf("invalid branch ratio specified\n");
> +				free(oob_enable);
>   				return -1;
>   			}
>   			for (i = 0; i < ci->core_count; i++) {


Acked-by: David Hunt <david.hunt@intel.com>

Patch
diff mbox series

diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 77797b1e1..0242cca1a 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -209,6 +209,7 @@  parse_args(int argc, char **argv)
 			}
 			if (branch_ratio <= 0.0 || branch_ratio > 100.0) {
 				printf("invalid branch ratio specified\n");
+				free(oob_enable);
 				return -1;
 			}
 			for (i = 0; i < ci->core_count; i++) {