goodix: Don't leak the templates array during verify
When verifying we initialize a temporary templates array but we never release it.
This commit is contained in:
parent
91ee03eb7a
commit
989d498eb9
1 changed files with 4 additions and 5 deletions
|
@ -350,9 +350,9 @@ fp_verify_cb (FpiDeviceGoodixMoc *self,
|
||||||
gxfp_cmd_response_t *resp,
|
gxfp_cmd_response_t *resp,
|
||||||
GError *error)
|
GError *error)
|
||||||
{
|
{
|
||||||
|
g_autoptr(GPtrArray) templates = NULL;
|
||||||
FpDevice *device = FP_DEVICE (self);
|
FpDevice *device = FP_DEVICE (self);
|
||||||
FpPrint *print = NULL;
|
FpPrint *print = NULL;
|
||||||
GPtrArray *templates = NULL;
|
|
||||||
gint cnt = 0;
|
gint cnt = 0;
|
||||||
gboolean find = false;
|
gboolean find = false;
|
||||||
|
|
||||||
|
@ -365,15 +365,14 @@ fp_verify_cb (FpiDeviceGoodixMoc *self,
|
||||||
{
|
{
|
||||||
if (fpi_device_get_current_action (device) == FPI_DEVICE_ACTION_VERIFY)
|
if (fpi_device_get_current_action (device) == FPI_DEVICE_ACTION_VERIFY)
|
||||||
{
|
{
|
||||||
|
templates = g_ptr_array_sized_new (1);
|
||||||
templates = g_ptr_array_new_with_free_func (g_object_unref);
|
|
||||||
fpi_device_get_verify_data (device, &print);
|
fpi_device_get_verify_data (device, &print);
|
||||||
g_ptr_array_add (templates, g_object_ref_sink (print));
|
g_ptr_array_add (templates, print);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fpi_device_get_identify_data (device, &templates);
|
fpi_device_get_identify_data (device, &templates);
|
||||||
|
g_ptr_array_ref (templates);
|
||||||
}
|
}
|
||||||
for (cnt = 0; cnt < templates->len; cnt++)
|
for (cnt = 0; cnt < templates->len; cnt++)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue