examples/vm_power: fix memory leak
authorRory Sexton <rory.sexton@intel.com>
Wed, 29 Jul 2020 08:37:54 +0000 (09:37 +0100)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 30 Oct 2020 12:16:09 +0000 (13:16 +0100)
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>
Acked-by: David Hunt <david.hunt@intel.com>
examples/vm_power_manager/main.c

index 17b3840..75d5b53 100644 (file)
@@ -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++) {