nuttx/boards/arm
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
..
a1x/pcduino-a10 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
am335x/beaglebone-black boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
c5471/c5471evm boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
cxd56xx Correct more improper use of malloc(), zalloc(), and free() 2020-08-04 20:41:43 +01:00
dm320/ntosd-dm320 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
efm32 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
eoss3/quickfeather boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
imx6/sabre-6quad boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
imxrt boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
kinetis Several USB improvements. 2020-07-24 13:24:53 -03:00
kl boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
lc823450/lc823450-xgevk boards: lc82345-xgevk: Replace license header with Apache License 2.0 2020-08-03 21:03:41 +01:00
lpc17xx_40xx boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
lpc31xx boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
lpc43xx boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
lpc54xx/lpcxpresso-lpc54628 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
lpc214x boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
lpc2378/olimex-lpc2378 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
max326xx/max32660-evsys boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
moxart/moxa boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
nrf52 fix nxstyle warnings 2020-07-20 17:11:11 +01:00
nuc1xx/nutiny-nuc120 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
s32k1xx boards: s32k1xx: Remove SPITOOL_PROGNAME 2020-07-29 00:48:48 -05:00
sam34 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
sama5 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
samd2l2 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
samd5e5 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
samv7 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
stm32 board/arm: Remove -march and -mcpu option 2020-07-21 22:11:34 -07:00
stm32f0l0g0 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
stm32f7 board/arm: Remove -march and -mcpu option 2020-07-21 22:11:34 -07:00
stm32h7 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
stm32l4 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
str71x/olimex-strp711 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
tiva boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
tms570 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00
xmc4 boards: Move toolchain related variables to Toolchain.defs 2020-07-20 17:10:37 +01:00