From dfdb01a1a9697a6a48fae9ea17fdc0c59585728c Mon Sep 17 00:00:00 2001 From: Saar Amar Date: Wed, 26 Oct 2016 20:07:43 -0700 Subject: Fix memory leak in ShvVpLoadCallback --- shvvp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/shvvp.c b/shvvp.c index 5b4a91e..9437ed5 100644 --- a/shvvp.c +++ b/shvvp.c @@ -224,7 +224,7 @@ ShvVpLoadCallback ( _In_ PSHV_CALLBACK_CONTEXT Context ) { - PSHV_VP_DATA vpData; + PSHV_VP_DATA vpData = NULL; INT32 status; // @@ -262,9 +262,7 @@ ShvVpLoadCallback ( { // // 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; } @@ -277,7 +275,6 @@ ShvVpLoadCallback ( // // Free the per-processor data // - ShvVpFreeData(vpData, 1); status = SHV_STATUS_NOT_PRESENT; goto Failure; } @@ -292,6 +289,10 @@ Failure: // // Return failure // + if (vpData != NULL) + { + ShvVpFreeData(vpData, 1); + } Context->FailedCpu = ShvOsGetCurrentProcessorNumber(); Context->FailureStatus = status; return; -- cgit v1.2.3