net/can: fix possible IOB resource leak when can close

If there is data in readahead, it needs to be released; otherwise,
it will cause the leakage of IOB resources

Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
zhanghongyu
2025-05-12 15:04:33 +08:00
committed by Xiang Xiao
parent 232ef950c6
commit 2b092adf48
+4
View File
@@ -169,6 +169,10 @@ void can_free(FAR struct can_conn_s *conn)
nxsem_destroy(&conn->sndsem);
#endif
/* Free the readahead queue */
iob_free_queue(&conn->readahead);
/* Free the connection. */
NET_BUFPOOL_FREE(g_can_connections, conn);