drivers: spi: spi_esp32_spim: Fix potential tx_temp leak
If rx_temp allocation fails then tx_temp needs to freed. Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
This commit is contained in:
parent
0ebc7c2b69
commit
1eff8e76bd
1 changed files with 1 additions and 0 deletions
|
@ -95,6 +95,7 @@ static int IRAM_ATTR spi_esp32_transfer(const struct device *dev)
|
||||||
rx_temp = k_calloc(((ctx->rx_len << 3) + 31) / 8, sizeof(uint8_t));
|
rx_temp = k_calloc(((ctx->rx_len << 3) + 31) / 8, sizeof(uint8_t));
|
||||||
if (!rx_temp) {
|
if (!rx_temp) {
|
||||||
LOG_ERR("Error allocating temp buffer Rx");
|
LOG_ERR("Error allocating temp buffer Rx");
|
||||||
|
k_free(tx_temp);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue