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
|
@ -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));
|
||||
if (!rx_temp) {
|
||||
LOG_ERR("Error allocating temp buffer Rx");
|
||||
k_free(tx_temp);
|
||||
return -ENOMEM;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue