[glib-networking] mock-pkcs11: avoid leak of mock_search_template_label
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking] mock-pkcs11: avoid leak of mock_search_template_label
- Date: Tue, 20 Apr 2021 21:37:45 +0000 (UTC)
commit c7c567e14e06ca84ad92283c34bcdaa680a55d40
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Tue Apr 20 16:36:26 2021 -0500
mock-pkcs11: avoid leak of mock_search_template_label
It could be leaked if this condition executes twice during the for loop
iteration. Not likely, but let's be robust and placate Coverity, even if
this is only test code.
tls/tests/mock-pkcs11.c | 1 +
1 file changed, 1 insertion(+)
---
diff --git a/tls/tests/mock-pkcs11.c b/tls/tests/mock-pkcs11.c
index a1a5a53..988a947 100644
--- a/tls/tests/mock-pkcs11.c
+++ b/tls/tests/mock-pkcs11.c
@@ -1308,6 +1308,7 @@ CK_DEFINE_FUNCTION(CK_RV, C_FindObjectsInit)(CK_SESSION_HANDLE hSession, CK_ATTR
else if (CKA_LABEL == pTemplate[i].type)
{
const char *cka_label_value = (char*)pTemplate[i].pValue;
+ g_clear_pointer (&mock_search_template_label, g_free);
mock_search_template_label = g_strndup (cka_label_value, pTemplate[i].ulValueLen);
}
else
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]