libcamera: device_enumerator: Fix memory leak in error path
The DeviceEnumerator::create() function allocates a DeviceEnumeratorUdev and fails to delete it in the error path, causing a memory leak. Fix it. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
This commit is contained in:
@@ -140,6 +140,8 @@ DeviceEnumerator *DeviceEnumerator::create()
|
||||
if (!enumerator->init())
|
||||
return enumerator;
|
||||
|
||||
delete enumerator;
|
||||
|
||||
/*
|
||||
* Either udev is not available or udev initialization failed. Fall back
|
||||
* on the sysfs enumerator.
|
||||
|
||||
Reference in New Issue
Block a user