From a13900befb56e3a5c4f93b27baec64a55bf772b9 Mon Sep 17 00:00:00 2001 From: Segwon Date: Tue, 10 Oct 2017 19:38:42 +0900 Subject: [PATCH] i2c: fixed that allocated memory is released when an error occurs. Change-Id: Ib2c6589ad52b3752297bf6579527b574dba3b3d6 Signed-off-by: Segwon --- src/daemon/peripheral_bus_i2c.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/daemon/peripheral_bus_i2c.c b/src/daemon/peripheral_bus_i2c.c index f989022..d55bcef 100644 --- a/src/daemon/peripheral_bus_i2c.c +++ b/src/daemon/peripheral_bus_i2c.c @@ -86,6 +86,7 @@ int peripheral_bus_i2c_open(int bus, int address, pb_data_h *handle, gpointer us i2c_handle->dev.i2c.buffer = malloc(INITIAL_BUFFER_SIZE); if (!(i2c_handle->dev.i2c.buffer)) { + peripheral_bus_data_free(i2c_handle); i2c_close(fd); _E("Failed to allocate data buffer"); return PERIPHERAL_ERROR_OUT_OF_MEMORY; -- 2.7.4