Merge pull request #3516 from yangjie11/yj_dev

[components][serial]关闭uart时,反初始化tx_dma->data_queue,防止内存泄漏
This commit is contained in:
Bernard Xiong 2020-04-10 20:13:05 +08:00 committed by GitHub
commit 446091fc10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
RT_ASSERT(tx_dma != RT_NULL);
rt_data_queue_deinit(&(tx_dma->data_queue));
rt_free(tx_dma);
serial->serial_tx = RT_NULL;
dev->open_flag &= ~RT_DEVICE_FLAG_DMA_TX;