diff options
author | NIIBE Yutaka <gniibe@fsij.org> | 2024-11-12 07:36:35 +0100 |
---|---|---|
committer | NIIBE Yutaka <gniibe@fsij.org> | 2024-11-12 07:36:35 +0100 |
commit | d994ffc56a0221051a7e3dae2fe649d3819c534a (patch) | |
tree | 882d87af64dc739012d28ba6630e03196c8dd2c9 | |
parent | scd: Fix a memory leak. (diff) | |
download | gnupg2-d994ffc56a0221051a7e3dae2fe649d3819c534a.tar.xz gnupg2-d994ffc56a0221051a7e3dae2fe649d3819c534a.zip |
scd: Clean up app_send_active_apps and app_send_card_list.
* scd/app.c (send_card_and_app_list): Only handle the case with
WANTCARD=NULL.
(app_send_card_list): Follow the change.
(app_send_active_apps): Factor out the case with WANTCARD!=NULL.
--
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
-rw-r--r-- | scd/app.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -2749,16 +2749,13 @@ send_serialno_and_app_status (card_t card, int with_apps, ctrl_t ctrl) /* Common code for app_send_card_list and app_send_active_apps. */ static gpg_error_t -send_card_and_app_list (ctrl_t ctrl, card_t wantcard, int with_apps) +send_card_and_app_list (ctrl_t ctrl, int with_apps) { gpg_error_t err; card_t c; card_t *cardlist = NULL; int n, ncardlist; - if (wantcard) - return send_serialno_and_app_status (wantcard, with_apps, ctrl); - card_list_r_lock (); for (n=0, c = card_top; c; c = c->next) n++; @@ -2781,8 +2778,6 @@ send_card_and_app_list (ctrl_t ctrl, card_t wantcard, int with_apps) { card_t card = cardlist[n]; - if (wantcard && wantcard != card) - continue; lock_card (card, ctrl); err = send_serialno_and_app_status (card, with_apps, ctrl); unlock_card (card); @@ -2803,7 +2798,7 @@ send_card_and_app_list (ctrl_t ctrl, card_t wantcard, int with_apps) gpg_error_t app_send_card_list (ctrl_t ctrl) { - return send_card_and_app_list (ctrl, NULL, 0); + return send_card_and_app_list (ctrl, 0); } @@ -2812,7 +2807,10 @@ app_send_card_list (ctrl_t ctrl) gpg_error_t app_send_active_apps (card_t card, ctrl_t ctrl) { - return send_card_and_app_list (ctrl, card, 1); + if (!card) + return send_card_and_app_list (ctrl, 1); + else + return send_serialno_and_app_status (card, 1, ctrl); } |