diff options
author | Cole Robinson <crobinso@redhat.com> | 2013-04-14 16:06:59 -0400 |
---|---|---|
committer | Alon Levy <alevy@redhat.com> | 2013-04-27 02:38:33 +0300 |
commit | ae12e3a643c66575c77211e1226ada041e56b889 (patch) | |
tree | 7cc0aabecf2ef895ea2d1f531ad43c67555da75d | |
parent | 909eedb74f88d1d6d9e6bbdc34875772e7a8a5ab (diff) | |
download | hqemu-ae12e3a643c66575c77211e1226ada041e56b889.zip hqemu-ae12e3a643c66575c77211e1226ada041e56b889.tar.gz |
ccid: Fix crash when backend isn't specified
Reproducer:
./x86_64-softmmu/qemu-system-x86_64 -device usb-ccid,id=ccid0 -usb -device ccid-card-emulated -monitor stdio
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Reviewed-by: Alon Levy <alevy@redhat.com>
-rw-r--r-- | hw/usb/ccid-card-emulated.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/hw/usb/ccid-card-emulated.c b/hw/usb/ccid-card-emulated.c index 094284d..deb6d47 100644 --- a/hw/usb/ccid-card-emulated.c +++ b/hw/usb/ccid-card-emulated.c @@ -503,9 +503,15 @@ static int emulated_initfn(CCIDCardState *base) if (init_pipe_signaling(card) < 0) { return -1; } - card->backend = parse_enumeration(card->backend_str, backend_enum_table, 0); + + card->backend = 0; + if (card->backend_str) { + card->backend = parse_enumeration(card->backend_str, + backend_enum_table, 0); + } + if (card->backend == 0) { - printf("unknown backend, must be one of:\n"); + printf("backend must be one of:\n"); for (ptable = backend_enum_table; ptable->name != NULL; ++ptable) { printf("%s\n", ptable->name); } |