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:
parent
93a037efff
commit
824ed85553
1 changed files with 2 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue