From 944df2f9c0269dbac75eaec0ba260053a7788ea8 Mon Sep 17 00:00:00 2001 From: Saar Amar Date: Mon, 24 Oct 2016 15:30:57 -0700 Subject: Update shvvp.c Fix memory leak in ShvVpLoadCallback. There is a flow (when ShvVpInitialize is failed) that the per-processor data is not freed before the goto Failure and return. Of-course, we can't free it in the Failure, since we need to distinguish between different flows of failures (fail to allocate, fail to initialize, hypervisor not present) So just keep freeing it anytime we fail for some reason (just as when our hypervisor is not present on line 275). Thanks :) --- shvvp.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shvvp.c b/shvvp.c index 1b34069..5b4a91e 100644 --- a/shvvp.c +++ b/shvvp.c @@ -261,8 +261,10 @@ ShvVpLoadCallback ( if (status != SHV_STATUS_SUCCESS) { // - // Bail out + // Bail out, free the allocated per-processor data + // Can't free it in Failure, since need to distinguish between the different flows // + ShvVpFreeData(vpData, 1); goto Failure; } -- cgit v1.2.3