memleak: Handle freeing return from spi call

mraa_spi_write_buf returns an allocated buffer.  Added call to free
the allocated memory.

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck
2017-03-29 16:31:01 -07:00
parent 8048e8734f
commit fa8ab6194d
2 changed files with 8 additions and 3 deletions

View File

@ -165,7 +165,8 @@ void
APA102::pushState(void)
{
CSOn();
m_spi->write(m_leds, m_frameLength);
uint8_t* recv = m_spi->write(m_leds, m_frameLength);
if (recv != NULL) free(recv);
CSOff();
}