We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents bc37399 + 508364b commit 1b04cdfCopy full SHA for 1b04cdf
source/spimodule.c
@@ -237,7 +237,7 @@ SPI_xfer(SPI *self, PyObject *args)
237
delay = 0;
238
}
239
240
- xferptr = (struct spi_ioc_transfer*) malloc(sizeof(struct spi_ioc_transfer) * len);
+ xferptr = (struct spi_ioc_transfer*) calloc(len, sizeof(struct spi_ioc_transfer));
241
txbuf = malloc(sizeof(__u8) * len);
242
rxbuf = malloc(sizeof(__u8) * len);
243
@@ -300,7 +300,7 @@ SPI_xfer2(SPI *self, PyObject *args)
300
int status;
301
uint16_t ii, len;
302
PyObject *list;
303
- struct spi_ioc_transfer xfer;
+ struct spi_ioc_transfer xfer = {0};
304
uint8_t *txbuf, *rxbuf;
305
306
if (!PyArg_ParseTuple(args, "O:xfer2", &list))
0 commit comments