[Spice-devel] [PATCH] Use proper free function for PK11_ReadRawAttribute call
Frediano Ziglio
fziglio at redhat.com
Tue Aug 14 09:35:55 UTC 2018
As documented in PK11_ReadRawAttribute data should be freed with
PORT_Free, not free or g_free.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
src/cac.c | 3 ++-
src/vcard_emul_nss.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/cac.c b/src/cac.c
index ba63685..6c49d9b 100644
--- a/src/cac.c
+++ b/src/cac.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <stdbool.h>
+#include <nss.h>
#include "cac.h"
#include "cac-aca.h"
@@ -728,7 +729,7 @@ cac_passthrough_container_process_apdu(VCard *card, VCardAPDU *apdu,
data = vcard_emul_read_object(card, pt_applet->label, &data_len);
if (data) {
tlv = simpletlv_parse(data, data_len, &tlv_len);
- g_free(data);
+ PORT_Free(data);
/* break the data buffer to TL and V buffers */
applet_private->tag_buffer_len = cac_create_tl_file(tlv, tlv_len,
diff --git a/src/vcard_emul_nss.c b/src/vcard_emul_nss.c
index 9658c5a..b750dce 100644
--- a/src/vcard_emul_nss.c
+++ b/src/vcard_emul_nss.c
@@ -1330,7 +1330,7 @@ vcard_emul_read_object(VCard *card, const char *label,
&& memcmp(label, result.data, result.len) == 0)
found = 1;
- free(result.data);
+ PORT_Free(result.data);
result.data = NULL;
if (found) {
--
2.17.1
More information about the Spice-devel
mailing list