From e638ffde530440ec3515f40aa75a414ea1100231 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Tue, 8 Dec 2020 03:40:25 +0200 Subject: libcamera: v4l2_device: Return a unique pointer from fromEntityName() The fromEntityName() function returns a pointer to a newly allocated V4L2Device instance, which must be deleted by the caller. This opens the door to memory leaks. Return a unique pointer instead, which conveys the API semantics better than a sentence in the documentation. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Jacopo Mondi --- test/libtest/buffer_source.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/libtest/buffer_source.cpp b/test/libtest/buffer_source.cpp index ee87c8cd..73563f2f 100644 --- a/test/libtest/buffer_source.cpp +++ b/test/libtest/buffer_source.cpp @@ -50,7 +50,7 @@ int BufferSource::allocate(const StreamConfiguration &config) return TestSkip; } - std::unique_ptr video{ V4L2VideoDevice::fromEntityName(media_.get(), videoDeviceName) }; + std::unique_ptr video = V4L2VideoDevice::fromEntityName(media_.get(), videoDeviceName); if (!video) { std::cout << "Failed to get video device from entity " << videoDeviceName << std::endl; -- cgit v1.2.1