mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-03 12:11:33 +01:00
scd: Handle a failure of libusb_init.
* scd/ccid-driver.c (ccid_get_reader_list, ccid_dev_scan): Handle failure. -- Reported-by: Yuriy M. Kaminskiy <yumkam@gmail.com> Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
663e5ed073
commit
5c33649782
@ -1228,7 +1228,12 @@ ccid_get_reader_list (void)
|
|||||||
|
|
||||||
if (!initialized_usb)
|
if (!initialized_usb)
|
||||||
{
|
{
|
||||||
libusb_init (NULL);
|
int rc;
|
||||||
|
if ((rc = libusb_init (NULL)))
|
||||||
|
{
|
||||||
|
DEBUGOUT_1 ("usb_init failed: %s.\n", libusb_error_name (rc));
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
initialized_usb = 1;
|
initialized_usb = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1292,9 +1297,17 @@ ccid_dev_scan (int *idx_max_p, struct ccid_dev_table **t_p)
|
|||||||
int idx = 0;
|
int idx = 0;
|
||||||
int err = 0;
|
int err = 0;
|
||||||
|
|
||||||
|
*idx_max_p = 0;
|
||||||
|
*t_p = NULL;
|
||||||
|
|
||||||
if (!initialized_usb)
|
if (!initialized_usb)
|
||||||
{
|
{
|
||||||
libusb_init (NULL);
|
int rc;
|
||||||
|
if ((rc = libusb_init (NULL)))
|
||||||
|
{
|
||||||
|
DEBUGOUT_1 ("usb_init failed: %s.\n", libusb_error_name (rc));
|
||||||
|
return gpg_error (GPG_ERR_NOT_FOUND);
|
||||||
|
}
|
||||||
initialized_usb = 1;
|
initialized_usb = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1373,8 +1386,6 @@ ccid_dev_scan (int *idx_max_p, struct ccid_dev_table **t_p)
|
|||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
*idx_max_p = 0;
|
|
||||||
*t_p = NULL;
|
|
||||||
for (i = 0; i < idx; i++)
|
for (i = 0; i < idx; i++)
|
||||||
{
|
{
|
||||||
free (ccid_dev_table[idx].ifcdesc_extra);
|
free (ccid_dev_table[idx].ifcdesc_extra);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user