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

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