Changeset 45bf63c in mainline for uspace/lib/usbdev/src/altiface.c


Ignore:
Timestamp:
2011-10-30T15:35:36Z (13 years ago)
Author:
Jan Vesely <jano.vesely@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
20a3465, 3ce78580
Parents:
1737bfb (diff), e978ada (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge from USB branch.

Cleanup libusbhost interfaces.
Fix few possible memory corruption/crashes and memory leaks.
Add device_remove hooks for usbflbk, usbhid.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/usbdev/src/altiface.c

    r1737bfb r45bf63c  
    9898        assert(config_descr_size > 0);
    9999
     100        *alternates_ptr = NULL;
    100101        if (interface_number < 0) {
    101                 alternates_ptr = NULL;
    102102                return EOK;
    103103        }
     
    105105        usb_alternate_interfaces_t *alternates
    106106            = malloc(sizeof(usb_alternate_interfaces_t));
    107 
    108107        if (alternates == NULL) {
    109108                return ENOMEM;
     
    119118        }
    120119
    121         alternates->alternatives = malloc(alternates->alternative_count
    122             * sizeof(usb_alternate_interface_descriptors_t));
     120        alternates->alternatives = calloc(alternates->alternative_count,
     121            sizeof(usb_alternate_interface_descriptors_t));
    123122        if (alternates->alternatives == NULL) {
    124123                free(alternates);
     
    176175}
    177176
    178 
     177void usb_alternate_interfaces_destroy(usb_alternate_interfaces_t *alternate)
     178{
     179        if (!alternate)
     180                return;
     181        free(alternate->alternatives);
     182        free(alternate);
     183}
    179184/**
    180185 * @}
Note: See TracChangeset for help on using the changeset viewer.