Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ionescu007/SimpleVisor.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaar Amar <saaramar5@gmail.com>2016-10-25 01:30:57 +0300
committerGitHub <noreply@github.com>2016-10-25 01:30:57 +0300
commit944df2f9c0269dbac75eaec0ba260053a7788ea8 (patch)
treee730a081a76546ea08d40de9d19dca4f816bada9
parenta5971726bc6a25aea9f5fc8c336e2c1516e900f5 (diff)
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 :)
-rw-r--r--shvvp.c4
1 files changed, 3 insertions, 1 deletions
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;
}