examples/vm_power: fix resource leak on error path
diff mbox series

Message ID e13b343082f5c968749370021775a4d548d2c6aa.1597841272.git.wangyunjian@huawei.com
State Rejected, archived
Delegated to: David Marchand
Headers show
Series
  • examples/vm_power: fix resource leak on error path
Related show

Checks

Context Check Description
ci/iol-testing success Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

wangyunjian Aug. 19, 2020, 12:54 p.m. UTC
From: Yunjian Wang <wangyunjian@huawei.com>

This patch fixes the resource leaks reported by coverity.

Coverity issue: 337674
Fixes: 95f648ff9eed ("examples/vm_power: make branch ratio threshold per core")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 examples/vm_power_manager/main.c | 1 +
 1 file changed, 1 insertion(+)

Comments

David Hunt Aug. 26, 2020, 10:12 a.m. UTC | #1
Hi wangyunjian,

On 19/8/2020 1:54 PM, wangyunjian wrote:
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> This patch fixes the resource leaks reported by coverity.
>
> Coverity issue: 337674
> Fixes: 95f648ff9eed ("examples/vm_power: make branch ratio threshold per core")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.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 3a8958058..6422d7b99 100644
> --- a/examples/vm_power_manager/main.c
> +++ b/examples/vm_power_manager/main.c
> @@ -206,6 +206,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>
David Marchand Oct. 30, 2020, 12:35 p.m. UTC | #2
On Wed, Aug 19, 2020 at 2:55 PM wangyunjian <wangyunjian@huawei.com> wrote:
>
> From: Yunjian Wang <wangyunjian@huawei.com>
>
> This patch fixes the resource leaks reported by coverity.
>
> Coverity issue: 337674
> Fixes: 95f648ff9eed ("examples/vm_power: make branch ratio threshold per core")
> Cc: stable@dpdk.org
>
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>

This is a duplicate of https://patchwork.dpdk.org/patch/74985/.
Took the patch from Rory as it predates this one.

Patch
diff mbox series

diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 3a8958058..6422d7b99 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -206,6 +206,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++) {