From: Guus Sliepen Date: Sun, 18 Oct 2015 11:54:14 +0000 (+0200) Subject: Fix a memory leak on invalid invocation of utcp_init(). X-Git-Url: http://git.meshlink.io/?p=utcp;a=commitdiff_plain;h=7d8a65c11dd4b0555575ff75efab859236c4964f Fix a memory leak on invalid invocation of utcp_init(). --- 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;