Commit 499de3e4 authored by Benjamin Berg's avatar Benjamin Berg
Browse files

print: Return sunk reference from deserialize function

This function was always documented to return a sunk reference, but it
did not do so. This change is technically backward incompatible.

However, it only has an effect if anything is doing a g_object_ref_sink.
Which may happen inside libfprint itself. With the change, most API
users (including fprintd) are fixed to do refcounting correctly. Any API
user which worked around this will have a memory leak now.

That is not ideal, but it is not really that bad overall. And returning
a floating reference for FpPrint creation was a bad idea in the first
place. And it really only makes sense for fp_print_new as the only
(public) use case is to create the template for enrollment.
parent 0ff7a076
...@@ -808,6 +808,7 @@ fp_print_deserialize (const guchar *data, ...@@ -808,6 +808,7 @@ fp_print_deserialize (const guchar *data,
"device-id", device_id, "device-id", device_id,
"device-stored", device_stored, "device-stored", device_stored,
g_object_ref_sink (result);
fpi_print_set_type (result, FPI_PRINT_NBIS); fpi_print_set_type (result, FPI_PRINT_NBIS);
for (i = 0; i < g_variant_n_children (prints); i++) for (i = 0; i < g_variant_n_children (prints); i++)
{ {
...@@ -857,6 +858,7 @@ fp_print_deserialize (const guchar *data, ...@@ -857,6 +858,7 @@ fp_print_deserialize (const guchar *data,
"device-stored", device_stored, "device-stored", device_stored,
"fpi-data", fp_data, "fpi-data", fp_data,
g_object_ref_sink (result);
} }
else else
{ {
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment