summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVince Rimkus <vjrimkus@outlook.com>2016-11-17 10:16:21 -0600
committerVince Rimkus <vjrimkus@outlook.com>2016-11-17 10:20:52 -0600
commit22099de1155b3c01ec72f5eed9b8d95c0bed43ad (patch)
tree612f8769094bcf26bb22dd8992cccb9c54f52ff1
parent2a833acf7e83ab96a4889c5befeb0c0b1e449163 (diff)
downloadchef-22099de1155b3c01ec72f5eed9b8d95c0bed43ad.tar.gz
fix memory leak
Signed-off-by: Vince Rimkus <vjrimkus@outlook.com>
-rw-r--r--distro/powershell/chef/chef.psm13
1 files changed, 1 insertions, 2 deletions
diff --git a/distro/powershell/chef/chef.psm1 b/distro/powershell/chef/chef.psm1
index 0ee9218035..9196d62e6c 100644
--- a/distro/powershell/chef/chef.psm1
+++ b/distro/powershell/chef/chef.psm1
@@ -231,7 +231,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
[ref] $si,
[ref] $pi
)
-
if (-Not $success) {
$reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
throw "Unable to create process [$ArgumentString]. Error code $reason."
@@ -262,7 +261,6 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
[ref] $bytesAvailable,
[ref] $bytesLeftThisMsg
)
-
if (-Not $success) {
$reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
throw "Output pipe unavailable for peeking. Error code $reason."
@@ -315,6 +313,7 @@ function Run-ExecutableAndWait($AppPath, $ArgumentString) {
$reason = [System.Runtime.InteropServices.Marshal]::GetLastWin32Error()
throw "Unable to release output read handle. Error code $reason."
}
+ [System.Runtime.InteropServices.Marshal]::FreeHGlobal($ptr)
}
function Get-ScriptDirectory {