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:
Laurent Pinchart 2019-01-08 16:44:32 +02:00
parent 93a037efff
commit 824ed85553

View file

@ -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.