sync.c: Do not free an incompleted transfer
authorHans de Goede <hdegoede@redhat.com>
Thu, 20 Jun 2013 10:52:25 +0000 (12:52 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 20 Jun 2013 10:52:25 +0000 (12:52 +0200)
commitedcb3829a869f3d6781d5239de035fb12e3a95c9
tree2e4a20863a4e56da21b36c7475853f5198c8eee4
parentcb96ec5b4728a2d1cfc9bdf2c32e9e8c98ed074e
sync.c: Do not free an incompleted transfer

Before this patch the code in sync.c would free an incomplete transfer
when libusb_handle_events_completed exits with an error twice in a row.

But we should never free an incomplete transfer, otherwise we may end up
referencing free-ed memory later on.

This patch simply logs an error and keeps on trying until the transfer
completes.

Note that if libusb_handle_events_completed keeps throwing an error the
entire time, without ever completing the transfer, this patch effectively
replaces a potential crash / unspecified behavior, with an endless loop
and logging a ton of errors making clear what is going on.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
libusb/sync.c
libusb/version_nano.h