From 7d8a65c11dd4b0555575ff75efab859236c4964f Mon Sep 17 00:00:00 2001 From: Guus Sliepen Date: Sun, 18 Oct 2015 13:54:14 +0200 Subject: [PATCH] Fix a memory leak on invalid invocation of utcp_init(). --- utcp.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utcp.c b/utcp.c index 2b2db97..ad19982 100644 --- a/utcp.c +++ b/utcp.c @@ -1309,15 +1309,15 @@ bool utcp_is_active(struct utcp *utcp) { } struct utcp *utcp_init(utcp_accept_t accept, utcp_pre_accept_t pre_accept, utcp_send_t send, void *priv) { - struct utcp *utcp = calloc(1, sizeof *utcp); - if(!utcp) - return NULL; - if(!send) { errno = EFAULT; return NULL; } + struct utcp *utcp = calloc(1, sizeof *utcp); + if(!utcp) + return NULL; + utcp->accept = accept; utcp->pre_accept = pre_accept; utcp->send = send; -- 2.39.2