From: Thomas Jarosch Date: Mon, 25 Oct 2010 10:34:55 +0000 (+0200) Subject: Fix uninitialized memory access of ret variable in async mode X-Git-Tag: v0.19~13 X-Git-Url: http://developer.intra2net.com/git/?a=commitdiff_plain;h=236e16d12a347db827c913a743fa6aab3d35d22e;p=libftdi Fix uninitialized memory access of ret variable in async mode --- diff --git a/src/ftdi.c b/src/ftdi.c index e2d7980..06f6293 100644 --- a/src/ftdi.c +++ b/src/ftdi.c @@ -1331,7 +1331,7 @@ static int _usb_get_async_urbs_pending(struct ftdi_context *ftdi) static void _usb_async_cleanup(struct ftdi_context *ftdi, int wait_for_more, int timeout_msec) { struct timeval tv; - struct usbdevfs_urb *urb=NULL; + struct usbdevfs_urb *urb; int ret; fd_set writefds; int keep_going=0; @@ -1345,6 +1345,9 @@ static void _usb_async_cleanup(struct ftdi_context *ftdi, int wait_for_more, int do { + ret = -1; + urb = NULL; + while (_usb_get_async_urbs_pending(ftdi) && (ret = ioctl(ftdi->usb_dev->fd, USBDEVFS_REAPURBNDELAY, &urb)) == -1 && errno == EAGAIN) @@ -1366,7 +1369,6 @@ static void _usb_async_cleanup(struct ftdi_context *ftdi, int wait_for_more, int urb->usercontext = FTDI_URB_USERCONTEXT_COOKIE; /* try to get more urbs that are ready now, but don't wait anymore */ - urb=NULL; keep_going=1; } else