Change-Id: Ibed226e76e6070bc45a2623d04a7bffe3dc68aa0
Signed-off-by: Hyeongsik Min <hyeongsik.min@samsung.com>
return ret;
uart_handle = peripheral_bus_uart_data_new(&pb_data->uart_list);
- if (!uart_handle)
+ if (!uart_handle) {
+ uart_close(fd);
return PERIPHERAL_ERROR_OUT_OF_MEMORY;
+ }
uart_handle->fd = fd;
uart_handle->port = port;
uart_handle->buffer = (uint8_t*)calloc(1, INITIAL_BUFFER_SIZE);
if (!uart_handle->buffer) {
_E("Failed to allocate buffer");
+ peripheral_bus_uart_data_free(uart_handle, &pb_data->uart_list);
+ uart_close(fd);
return PERIPHERAL_ERROR_OUT_OF_MEMORY;
}