Skip to content

Commit a63b847

Browse files
committed
Merge branch 'fix/i2c_master_asnyc_memory_leak' into 'master'
fix(i2c_master): Fix the memory leak in the async transaction See merge request espressif/esp-idf!33847
2 parents 1e4ebab + fb95332 commit a63b847

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/esp_driver_i2c/i2c_master.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ static esp_err_t s_i2c_asynchronous_transaction(i2c_master_dev_handle_t i2c_dev,
845845
// Clear unused memory
846846
uint8_t unused_dim = I2C_STATIC_OPERATION_ARRAY_MAX - ops_dim;
847847
if (unused_dim != 0) {
848-
memset(&i2c_master->i2c_async_ops[i2c_master->ops_prepare_idx] + sizeof(i2c_operation_t) * ops_dim, 0, sizeof(i2c_operation_t) * unused_dim);
848+
memset(&i2c_master->i2c_async_ops[i2c_master->ops_prepare_idx][ops_dim], 0, sizeof(i2c_operation_t) * unused_dim);
849849
}
850850
// Record current operation and feed to transaction queue.
851851
ops_current = &i2c_master->i2c_async_ops[i2c_master->ops_prepare_idx][0];

0 commit comments

Comments
 (0)