Skip to content

Commit 5cab38a

Browse files
lib: sm_at_client: Release buffer in UART re-enable
In error case, when UART is re-enabled, the RX-buffer was allocated, but not released. Signed-off-by: Markus Lassila <markus.lassila@nordicsemi.no> Co-authored-by: Tommi Rantanen <tommi.rantanen@nordicsemi.no>
1 parent f89eb35 commit 5cab38a

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

lib/sm_at_client/sm_at_client.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,10 @@ static int rx_enable(void)
173173
}
174174

175175
ret = uart_rx_enable(uart_dev, buf->buf, sizeof(buf->buf), UART_RX_TIMEOUT_US);
176-
if (ret && ret != -EBUSY) {
176+
if (ret == -EBUSY) {
177+
LOG_WRN("UART RX already enabled");
178+
buf_unref(buf->buf);
179+
} else if (ret) {
177180
LOG_ERR("uart_rx_enable failed: %d", ret);
178181
buf_unref(buf->buf);
179182
return ret;

0 commit comments

Comments
 (0)