summaryrefslogtreecommitdiffstats
path: root/scd/app.c
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2019-08-21 02:56:44 +0200
committerNIIBE Yutaka <gniibe@fsij.org>2019-08-21 05:01:21 +0200
commitd4f135c34b332f1f833617a7f1ef0bdbff5eb589 (patch)
tree71ec1b50ba6f341922119f2acf27444e5952b4fa /scd/app.c
parentdoc: fix minor spelling and tense errors (diff)
downloadgnupg2-d4f135c34b332f1f833617a7f1ef0bdbff5eb589.tar.xz
gnupg2-d4f135c34b332f1f833617a7f1ef0bdbff5eb589.zip
scd: Fix switching to another APP.
* scd/app.c (select_additional_application): Initialize card of APP. Break after the selection. Don't free APP if success. Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
Diffstat (limited to 'scd/app.c')
-rw-r--r--scd/app.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/scd/app.c b/scd/app.c
index 57c4b7743..edd3174dc 100644
--- a/scd/app.c
+++ b/scd/app.c
@@ -723,13 +723,17 @@ select_additional_application (ctrl_t ctrl, const char *name)
log_info ("error allocating app context: %s\n", gpg_strerror (err));
goto leave;
}
+ app->card = card;
/* Find the app and run the select. */
for (i=0; app_priority_list[i].apptype; i++)
{
if (app_priority_list[i].apptype == req_apptype
&& is_app_allowed (app_priority_list[i].name))
- err = app_priority_list[i].select_func (app);
+ {
+ err = app_priority_list[i].select_func (app);
+ break;
+ }
}
if (!app_priority_list[i].apptype
|| (err && gpg_err_code (err) != GPG_ERR_OBJ_TERM_STATE))
@@ -743,11 +747,12 @@ select_additional_application (ctrl_t ctrl, const char *name)
app->next = card->app;
card->app = app;
ctrl->current_apptype = app->apptype;
- log_error ("added app '%s' to the card context\n", strapptype(app->apptype));
+ log_info ("added app '%s' to the card context\n", strapptype (app->apptype));
leave:
unlock_card (card);
- xfree (app);
+ if (err)
+ xfree (app);
return err;
}
@@ -990,7 +995,7 @@ maybe_switch_app (ctrl_t ctrl, card_t card)
app->next = card->app;
card->app = app;
ctrl->current_apptype = app->apptype;
- log_error ("switched to '%s'\n", strapptype(app->apptype));
+ log_info ("switched to '%s'\n", strapptype (app->apptype));
return 0;
}