Skip to content

Free the spi_device pointer before early returns.#16

Merged
JiapengLi merged 1 commit into
JiapengLi:masterfrom
fistaco:fix-spi-native-memleak
Apr 22, 2020
Merged

Free the spi_device pointer before early returns.#16
JiapengLi merged 1 commit into
JiapengLi:masterfrom
fistaco:fix-spi-native-memleak

Conversation

@fistaco
Copy link
Copy Markdown
Contributor

@fistaco fistaco commented Dec 1, 2019

The allocated memory for spi_device was not free()'d in the case where the SPI device cannot be opened, nor in the case where the SPI port cannot be set to 8 bits per word.

This results in potential memory leaks, which are fixed by free()'ing the spi_device pointer before returning from the aforementioned execution paths.

The allocated memory for spi_device was not free()'d in the case where
the SPI device cannot be opened, nor in the case where the SPI port
cannot be set to 8 bits per word.
@JiapengLi JiapengLi merged commit 010a8f1 into JiapengLi:master Apr 22, 2020
@JiapengLi
Copy link
Copy Markdown
Owner

Thank you for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants