[libcamera-devel] [PATCH v1 2/2] pipeline: raspberrypi: Do not unconditionally free buffers on close

Naushir Patuck naush at raspberrypi.com
Fri Oct 28 13:52:00 CEST 2022


When a camera is terminated, do not unconditionally free buffers in the
RPiCameraData destructor. Otherwise, this causes harmless error log messages
to be displayed if no buffer have previously been allocated.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
---
 src/libcamera/pipeline/raspberrypi/raspberrypi.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
index 343f8cb2c7ed..31107e1338bf 100644
--- a/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
+++ b/src/libcamera/pipeline/raspberrypi/raspberrypi.cpp
@@ -191,7 +191,8 @@ public:
 
 	~RPiCameraData()
 	{
-		freeBuffers();
+		if (buffersAllocated_)
+			freeBuffers();
 	}
 
 	void freeBuffers();
-- 
2.25.1



More information about the libcamera-devel mailing list