diff --git a/arch/sim/src/sim/posix/sim_linuxi2c.c b/arch/sim/src/sim/posix/sim_linuxi2c.c index 009f9fa672..8b62b6f53f 100644 --- a/arch/sim/src/sim/posix/sim_linuxi2c.c +++ b/arch/sim/src/sim/posix/sim_linuxi2c.c @@ -269,7 +269,7 @@ struct i2c_master_s *sim_i2cbus_initialize(int bus) struct linux_i2cbus_master_s *priv; char filename[20]; - priv = (struct linux_i2cbus_master_s *)malloc(sizeof(priv)); + priv = (struct linux_i2cbus_master_s *)malloc(sizeof(*priv)); if (priv == NULL) { ERROR("Failed to allocate private i2c master driver"); diff --git a/arch/sim/src/sim/posix/sim_linuxspi.c b/arch/sim/src/sim/posix/sim_linuxspi.c index 466ab40ce2..ba3c3a6e03 100644 --- a/arch/sim/src/sim/posix/sim_linuxspi.c +++ b/arch/sim/src/sim/posix/sim_linuxspi.c @@ -702,7 +702,7 @@ struct spi_dev_s *sim_spi_initialize(const char *filename) { struct linux_spi_dev_s *priv; - priv = (struct linux_spi_dev_s *)malloc(sizeof(priv)); + priv = (struct linux_spi_dev_s *)malloc(sizeof(*priv)); if (priv == NULL) { ERROR("Failed to allocate private spi master driver");