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

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