Skip to content

Commit ff09587

Browse files
authored
[components/drivers] update pipe.c
Fixed stackover flow bug when create pipe->fifo
1 parent 5b30011 commit ff09587

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

components/drivers/src/pipe.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,11 @@ rt_err_t rt_pipe_open (rt_device_t device, rt_uint16_t oflag)
330330
if (pipe->fifo == RT_NULL)
331331
{
332332
pipe->fifo = rt_ringbuffer_create(pipe->bufsz);
333+
if (pipe->fifo == RT_NULL)
334+
{
335+
rt_mutex_release(&(pipe->lock));
336+
return -RT_ENOMEM;
337+
}
333338
}
334339

335340
rt_mutex_release(&(pipe->lock));

0 commit comments

Comments
 (0)