diff options
Diffstat (limited to 'ecp/test/init.c')
-rw-r--r-- | ecp/test/init.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/ecp/test/init.c b/ecp/test/init.c index 4dff693..7b59578 100644 --- a/ecp/test/init.c +++ b/ecp/test/init.c @@ -14,8 +14,19 @@ static int v_rng(void *buf, size_t bufsize) { return 0; } -static ECPConnection *conn_alloc(unsigned char type) { - return malloc(sizeof(ECPConnection)); +static ECPConnection *conn_alloc(ECPSocket *sock, unsigned char type) { + ECPConnection *conn; + int rv; + + conn = malloc(sizeof(ECPConnection)); + if (conn == NULL) return NULL; + + rv = ecp_conn_init(conn, sock, type); + if (rv) { + free(conn); + return NULL; + } + return conn; } static void conn_free(ECPConnection *conn) { |