Teckna Teckna

Bug in USB?

Discussion created by Teckna Teckna on Sep 26, 2012
Latest reply on Oct 11, 2012 by Kari Sipinen

Hi everyone,


I've found a possible bug in MQX 3.8.1, USB device library.


In the khci_dev_main.c file, in the _usb_dci_usbfs_preinit function, at line 1363 there is a memory allocation call (USB_mem_alloc_zero) returned in the usb_dev_ptr variable. At line 1368 there is a check if the returned value is not null. The instructions between lines 1369 and 1408 are not executed if the memory allocation failed. However the assignments at lines 1410-1412 are executed regardless the value of the usb_dev_ptr variable, even if the memory allocation failed, resulting in an exception.


Many thanks