nuttx-update/drivers/usbhost
Gregory Nutt d09f6aaa72 Correct more improper use of malloc(), zalloc(), and free()
malloc() and free() should never be used within the OS. This will work in the FLAT build because there is only a single heap, but will cause problems in PROTECTED and KERNEL build modes where there are separate heaps for user and kernel memory.

Typically kmm_malloc(), kmm_zalloc(), and kmm_free() should be called within the kernel in those build modes to use the kernel heap.

Memory is never free.  Possible memory leak:

    ./boards/arm/cxd56xx/common/src/cxd56_crashdump.c:  pdump = malloc(sizeof(fullcontext_t));

Memory allocated with malloc(), but freed with kmm_free():

    ./drivers/usbhost/usbhost_composite.c:  cfgbuffer = (FAR uint8_t *)malloc(CUSTOM_CONFIG_BUFSIZE);

Memory is never freed in these cases.  It is allocated in the driver initialization logic, but there is no corresponding uninitialization logic; memory is not freed on error conditions:

    ./arch/arm/src/lc823450/lc823450_i2s.c:  priv = (struct lc823450_i2s_s *)zalloc(sizeof(struct lc823450_i2s_s));
    ./arch/arm/src/sam34/sam_spi.c:  spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
    ./arch/arm/src/sama5/sam_spi.c:  spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));
    ./arch/arm/src/samv7/sam_spi.c:  spics = (struct sam_spics_s *)zalloc(sizeof(struct sam_spics_s));

Memory is allocated with zalloc() but freed on error conditions with kmm_free():

    ./arch/arm/src/sama5/sam_ssc.c:  priv = (struct sam_ssc_s *)zalloc(sizeof(struct sam_ssc_s));
    ./arch/arm/src/samv7/sam_ssc.c:  priv = (struct sam_ssc_s *)zalloc(sizeof(struct sam_ssc_s));
    ./arch/arm/src/stm32/stm32_i2s.c:  priv = (struct stm32_i2s_s *)zalloc(sizeof(struct stm32_i2s_s));

Memory is never freed:

    ./drivers/spi/spi_bitbang.c:  priv = (FAR struct spi_bitbang_s *)zalloc(sizeof(struct spi_bitbang_s));
2020-08-04 20:41:43 +01:00
..
hid_parser.c drivers/usbhost/hid_parser.c: nxstyle fixes 2020-08-03 22:52:31 -05:00
Kconfig Fix issues reported on PR #1233 2020-06-15 07:13:21 -06:00
Make.defs Add support to CDC-MBIM USB host driver 2020-06-15 07:13:21 -06:00
usbhost_cdcacm.c global change: fix tools/checkpatch.sh warnnings 2020-04-09 10:29:28 -06:00
usbhost_cdcmbim.c Fix devif_timer() function call 2020-06-15 07:13:21 -06:00
usbhost_composite.c Correct more improper use of malloc(), zalloc(), and free() 2020-08-04 20:41:43 +01:00
usbhost_composite.h Fix some typographical errors. 2018-09-14 06:55:45 -06:00
usbhost_devaddr.c Check return from nxsem_wait_initialize() 2020-03-30 21:53:12 +01:00
usbhost_enumerate.c Run codespell -w against all files 2020-02-22 14:45:07 -06:00
usbhost_findclass.c Remove exra whitespace from files (#189) 2020-01-31 09:24:49 -06:00
usbhost_ft232r.c drivers/usbhost/usbhost_ft232r.c: Cosmetic 2020-05-28 21:17:58 +01:00
usbhost_hidkbd.c sched/: Make more naming consistent 2020-05-17 14:01:00 -03:00
usbhost_hidmouse.c sched/: Make more naming consistent 2020-05-17 14:01:00 -03:00
usbhost_hub.c Run codespell -w with the latest dictonary again 2020-02-23 22:27:46 +01:00
usbhost_max3421e.c sched/: Make more naming consistent 2020-05-17 14:01:00 -03:00
usbhost_registerclass.c Remove exra whitespace from files (#189) 2020-01-31 09:24:49 -06:00
usbhost_registry.c USB host drivers: Change all parmeters named class to usbclass to avoid C++ conflicts 2015-01-11 08:05:09 -06:00
usbhost_registry.h Make some file section headers more consistent with standard 2015-04-08 07:15:32 -06:00
usbhost_skeleton.c Check return from nxsem_wait_initialize() 2020-03-30 21:53:12 +01:00
usbhost_storage.c global change: fix tools/checkpatch.sh warnnings 2020-04-09 10:29:28 -06:00
usbhost_trace.c Fix lots of occurrences of 'the the', 'the there', 'the these', 'the then', 'the they. 2017-05-11 13:35:56 -06:00
usbhost_xboxcontroller.c Char drivers should return -ENOTTY if CMD is not recognized 2020-06-06 14:51:02 -03:00