Blame SOURCES/0009-print-Ensure-xyt-struct-is-not-leaked-during-deseria.patch

73b847
From 9b48864c5b41111e1c6f40c1623b0f2393c3cc58 Mon Sep 17 00:00:00 2001
73b847
From: Benjamin Berg <bberg@redhat.com>
73b847
Date: Mon, 25 Nov 2019 18:41:44 +0100
73b847
Subject: [PATCH 009/181] print: Ensure xyt struct is not leaked during
73b847
 deserialization
73b847
73b847
In the unlikely event of an error, the variable may have been leaked.
73b847
Fix this by using g_autoptr combined with a g_steal_pointer.
73b847
---
73b847
 libfprint/fp-print.c | 4 ++--
73b847
 1 file changed, 2 insertions(+), 2 deletions(-)
73b847
73b847
diff --git a/libfprint/fp-print.c b/libfprint/fp-print.c
73b847
index 592be14..1a6a70f 100644
73b847
--- a/libfprint/fp-print.c
73b847
+++ b/libfprint/fp-print.c
73b847
@@ -1047,7 +1047,7 @@ fp_print_deserialize (const guchar *data,
73b847
       fpi_print_set_type (result, FP_PRINT_NBIS);
73b847
       for (i = 0; i < g_variant_n_children (prints); i++)
73b847
         {
73b847
-          struct xyt_struct *xyt = g_new0 (struct xyt_struct, 1);
73b847
+          g_autofree struct xyt_struct *xyt = g_new0 (struct xyt_struct, 1);
73b847
           const gint32 *xcol, *ycol, *thetacol;
73b847
           gsize xlen, ylen, thetalen;
73b847
           g_autoptr(GVariant) xyt_data = NULL;
73b847
@@ -1078,7 +1078,7 @@ fp_print_deserialize (const guchar *data,
73b847
           memcpy (xyt->ycol, ycol, sizeof (xcol[0]) * xlen);
73b847
           memcpy (xyt->thetacol, thetacol, sizeof (xcol[0]) * xlen);
73b847
 
73b847
-          g_ptr_array_add (result->prints, xyt);
73b847
+          g_ptr_array_add (result->prints, g_steal_pointer (&xyt));
73b847
         }
73b847
     }
73b847
   else if (type == FP_PRINT_RAW)
73b847
-- 
73b847
2.24.1
73b847