Blame SOURCES/0006-tcti-initialize-GError-to-NULL.patch

d9c268
From a645f8c656b47568072351f4bfa58960016fbbac Mon Sep 17 00:00:00 2001
d9c268
From: Nicolas Iooss <nicolas.iooss@ledger.fr>
d9c268
Date: Mon, 27 Sep 2021 16:46:42 +0200
d9c268
Subject: [PATCH 6/6] tcti: initialize GError to NULL
d9c268
d9c268
When an error happens in `tcti_tabrmd_read`, Glib reports:
d9c268
d9c268
    (process:905338): GLib-WARNING **: 06:59:08.971: GError set over the
d9c268
    top of a previous GError or uninitialized memory.
d9c268
    This indicates a bug in someone's code. You must ensure an error is
d9c268
    NULL before it's set.
d9c268
    The overwriting error message was: Error receiving data: Connection
d9c268
    reset by peer
d9c268
d9c268
This warning was reported on
d9c268
https://github.com/tpm2-software/tpm2-pkcs11/issues/705
d9c268
d9c268
Fix the warning by initializing `error` correctly.
d9c268
d9c268
Signed-off-by: Nicolas Iooss <nicolas.iooss@ledger.fr>
d9c268
---
d9c268
 src/tcti-tabrmd.c | 2 +-
d9c268
 1 file changed, 1 insertion(+), 1 deletion(-)
d9c268
d9c268
diff --git a/src/tcti-tabrmd.c b/src/tcti-tabrmd.c
d9c268
index d96709e..d0ab74d 100644
d9c268
--- a/src/tcti-tabrmd.c
d9c268
+++ b/src/tcti-tabrmd.c
d9c268
@@ -187,7 +187,7 @@ tcti_tabrmd_read (TSS2_TCTI_TABRMD_CONTEXT *ctx,
d9c268
                   size_t size,
d9c268
                   int32_t timeout)
d9c268
 {
d9c268
-    GError *error;
d9c268
+    GError *error = NULL;
d9c268
     ssize_t num_read;
d9c268
     int ret;
d9c268
 
d9c268
-- 
d9c268
2.34.3
d9c268