[components][serial]关闭uart时,反初始化tx_dma->data_queue,防止内存泄漏

This commit is contained in:
yangjie 2020-04-10 18:41:59 +08:00
parent 6375094569
commit cb9bc38ec9
1 changed files with 2 additions and 0 deletions

View File

@ -785,6 +785,8 @@ static rt_err_t rt_serial_close(struct rt_device *dev)
tx_dma = (struct rt_serial_tx_dma*)serial->serial_tx; tx_dma = (struct rt_serial_tx_dma*)serial->serial_tx;
RT_ASSERT(tx_dma != RT_NULL); RT_ASSERT(tx_dma != RT_NULL);
rt_data_queue_deinit(&(tx_dma->data_queue));
rt_free(tx_dma); rt_free(tx_dma);
serial->serial_tx = RT_NULL; serial->serial_tx = RT_NULL;
dev->open_flag &= ~RT_DEVICE_FLAG_DMA_TX; dev->open_flag &= ~RT_DEVICE_FLAG_DMA_TX;