From 9c219fbc44d725811af2a5cb02a24afedd16ae68 Mon Sep 17 00:00:00 2001 From: Marek Kowalski Date: Wed, 18 Sep 2019 18:56:36 +0100 Subject: [PATCH] Fixed memory leak --- src/LiveScanClient/azureKinectCapture.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/LiveScanClient/azureKinectCapture.cpp b/src/LiveScanClient/azureKinectCapture.cpp index f8310f2..0cafebd 100644 --- a/src/LiveScanClient/azureKinectCapture.cpp +++ b/src/LiveScanClient/azureKinectCapture.cpp @@ -85,17 +85,21 @@ bool AzureKinectCapture::AcquireFrame() k4a_wait_result_t captureResult = k4a_device_get_capture(kinectSensor, &capture, captureTimeoutMs); if (captureResult != K4A_WAIT_RESULT_SUCCEEDED) { + k4a_capture_release(capture); return false; } k4a_image_release(colorImage); k4a_image_release(depthImage); + colorImage = k4a_capture_get_color_image(capture); depthImage = k4a_capture_get_depth_image(capture); if (colorImage == NULL || depthImage == NULL) + { + k4a_capture_release(capture); return false; - + } if (pColorRGBX == NULL) {