laforge submitted this change.
scard: add comment about memory-leak in libpcsclite
As it seems, SCardReleaseContext does not free all of the memory
allocated by SCardEstablishContext. The probem has no real-world
impact, but still showas up in valgrind. Let's add a comment so
that we do not forget what causes the leak.
Related: SYS#8101
Change-Id: I5224f3824ce2ad33e678cd859ad28c47788dbb24
---
M src/ipa/scard.c
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/ipa/scard.c b/src/ipa/scard.c
index 806bb9d..b41ba24 100644
--- a/src/ipa/scard.c
+++ b/src/ipa/scard.c
@@ -182,6 +182,9 @@
rc = SCardDisconnect(ctx->hCard, SCARD_UNPOWER_CARD);
PCSC_ERROR(ctx->reader_num, rc, "SCardDisconnect");
+ /* As it seems the libpcsc-lite API calls SCardReleaseContext / SCardEstablishContext leak memoroy. There is
+ * always a remaining, still reachable amount of 1,614 bytes present when the program exits. Since we establish
+ * the hContext only once in this implementation this problem is no matter of concern. */
rc = SCardReleaseContext(ctx->hContext);
PCSC_ERROR(ctx->reader_num, rc, "SCardReleaseContext");
To view, visit change 42873. To unsubscribe, or for help writing mail filters, visit settings.