From ee379eb53516e6f38dd8ed1305c79f41f37d0265 Mon Sep 17 00:00:00 2001 From: Francisco Molina Date: Fri, 11 Sep 2020 11:19:58 +0200 Subject: [PATCH] sys/pipe/pipe_dynamic: fix possible null pointer dereference --- sys/pipe/pipe_dynamic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/pipe/pipe_dynamic.c b/sys/pipe/pipe_dynamic.c index 6de2333dd0..d70d2039a9 100644 --- a/sys/pipe/pipe_dynamic.c +++ b/sys/pipe/pipe_dynamic.c @@ -42,8 +42,9 @@ pipe_t *pipe_malloc(unsigned size) if (m_pipe) { ringbuffer_init(&m_pipe->rb, m_pipe->buffer, size); pipe_init(&m_pipe->pipe, &m_pipe->rb, free); + return &m_pipe->pipe; } - return &m_pipe->pipe; + return NULL; } void pipe_free(pipe_t *rp)