mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-06-13 12:43:56 +08:00
[components/drivers] update pipe.c
Fixed stackover flow bug when create pipe->fifo
This commit is contained in:
@@ -330,6 +330,11 @@ rt_err_t rt_pipe_open (rt_device_t device, rt_uint16_t oflag)
|
||||
if (pipe->fifo == RT_NULL)
|
||||
{
|
||||
pipe->fifo = rt_ringbuffer_create(pipe->bufsz);
|
||||
if (pipe->fifo == RT_NULL)
|
||||
{
|
||||
rt_mutex_release(&(pipe->lock));
|
||||
return -RT_ENOMEM;
|
||||
}
|
||||
}
|
||||
|
||||
rt_mutex_release(&(pipe->lock));
|
||||
|
||||
Reference in New Issue
Block a user