From 124fe7fb1b7a1db8cb2ebb9edae84716ffaf37ce Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 23 May 2014 13:24:34 +0200 Subject: [PATCH] libcacard: Plug memory leaks around vreader_get_reader_list() Spotted by Coverity. Signed-off-by: Markus Armbruster Reviewed-by: Alon Levy Signed-off-by: Michael Tokarev --- libcacard/vcard_emul_nss.c | 4 ++++ libcacard/vscclient.c | 1 + 2 files changed, 5 insertions(+) diff --git a/libcacard/vcard_emul_nss.c b/libcacard/vcard_emul_nss.c index 75b9d79412..78265932fa 100644 --- a/libcacard/vcard_emul_nss.c +++ b/libcacard/vcard_emul_nss.c @@ -433,11 +433,13 @@ vcard_emul_find_vreader_from_slot(PK11SlotInfo *slot) VReader *reader = vreader_list_get_reader(current_entry); VReaderEmul *reader_emul = vreader_get_private(reader); if (reader_emul->slot == slot) { + vreader_list_delete(reader_list); return reader; } vreader_free(reader); } + vreader_list_delete(reader_list); return NULL; } @@ -1059,6 +1061,8 @@ vcard_emul_replay_insertion_events(void) next_entry = vreader_list_get_next(current_entry); vreader_queue_card_event(vreader); } + + vreader_list_delete(list); } /* diff --git a/libcacard/vscclient.c b/libcacard/vscclient.c index 29f4958089..f2a753a417 100644 --- a/libcacard/vscclient.c +++ b/libcacard/vscclient.c @@ -570,6 +570,7 @@ do_command(GIOChannel *source, "CARD_PRESENT" : " ", vreader_get_name(reader)); } + vreader_list_delete(list); } else if (*string != 0) { printf("valid commands:\n"); printf("insert [reader_id]\n"); -- 2.11.4.GIT