diff --git a/examples/storage.c b/examples/storage.c index 53a61be..ebffb33 100644 --- a/examples/storage.c +++ b/examples/storage.c @@ -22,6 +22,7 @@ #define FP_COMPONENT "example-storage" #include +#include #include "storage.h" #include @@ -163,8 +164,8 @@ FpPrint * print_create_template (FpDevice *dev, FpFinger finger) { g_autoptr(GDateTime) datetime = NULL; + g_autoptr(GDate) date = NULL; FpPrint *template = NULL; - GDate *date = NULL; gint year, month, day; template = fp_print_new (dev); @@ -174,7 +175,6 @@ print_create_template (FpDevice *dev, FpFinger finger) g_date_time_get_ymd (datetime, &year, &month, &day); date = g_date_new_dmy (day, month, year); fp_print_set_enroll_date (template, date); - g_date_free (date); return template; } diff --git a/libfprint/drivers/synaptics/synaptics.c b/libfprint/drivers/synaptics/synaptics.c index 49bdfec..8333fda 100644 --- a/libfprint/drivers/synaptics/synaptics.c +++ b/libfprint/drivers/synaptics/synaptics.c @@ -520,8 +520,8 @@ list_msg_cb (FpiDeviceSynaptics *self, userid[12] == '-' && userid[14] == '-' && userid[23] == '-') { g_autofree gchar *copy = g_strdup (userid); + g_autoptr(GDate) date = NULL; gint32 date_ymd; - GDate *date = NULL; gint32 finger; gchar *username; /* Try to parse information from the string. */ @@ -536,7 +536,6 @@ list_msg_cb (FpiDeviceSynaptics *self, date = g_date_new (); fp_print_set_enroll_date (print, date); - g_date_free (date); copy[14] = '\0'; finger = g_ascii_strtoll (copy + 13, NULL, 16); diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c index b17b203..d02bf0a 100644 --- a/libfprint/fp-print.c +++ b/libfprint/fp-print.c @@ -753,8 +753,8 @@ fp_print_deserialize (const guchar *data, g_autoptr(GVariant) raw_value = NULL; g_autoptr(GVariant) value = NULL; g_autoptr(GVariant) print_data = NULL; + g_autoptr(GDate) date = NULL; guchar *aligned_data = NULL; - GDate *date = NULL; guint8 finger_int8; FpFinger finger; g_autofree gchar *username = NULL; @@ -882,8 +882,6 @@ fp_print_deserialize (const guchar *data, "enroll_date", date, NULL); - g_date_free (date); - return g_steal_pointer (&result); invalid_format: diff --git a/libfprint/fpi-compat.h b/libfprint/fpi-compat.h index 0904ab2..59025e1 100644 --- a/libfprint/fpi-compat.h +++ b/libfprint/fpi-compat.h @@ -35,4 +35,5 @@ G_DEFINE_AUTOPTR_CLEANUP_FUNC (GParamSpec, g_param_spec_unref); #if !GLIB_CHECK_VERSION (2, 63, 3) typedef struct _FpDeviceClass FpDeviceClass; G_DEFINE_AUTOPTR_CLEANUP_FUNC (FpDeviceClass, g_type_class_unref); +G_DEFINE_AUTOPTR_CLEANUP_FUNC (GDate, g_date_free); #endif