net/can: Release IOB when failed to queue in datahandler
If we just clear the IOB when failed to queue, we'll leak it. Signed-off-by: Zhe Weng <wengzhe@xiaomi.com>
This commit is contained in:
parent
af15cd40aa
commit
1adfc1ae79
1 changed files with 9 additions and 4 deletions
|
|
@ -214,11 +214,16 @@ uint16_t can_datahandler(FAR struct net_driver_s *dev,
|
|||
can_readahead_signal(conn);
|
||||
#endif
|
||||
ret = iob->io_pktlen;
|
||||
|
||||
/* Device buffer has been enqueued, clear the handle */
|
||||
|
||||
netdev_iob_clear(dev);
|
||||
}
|
||||
else
|
||||
{
|
||||
nerr("ERROR: Failed to queue the I/O buffer chain: %d\n", ret);
|
||||
netdev_iob_release(dev);
|
||||
}
|
||||
|
||||
/* Device buffer must be enqueue or freed, clear the handle */
|
||||
|
||||
netdev_iob_clear(dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue