summaryrefslogtreecommitdiff
path: root/ecp/test/init.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2022-01-19 02:49:47 +0100
committerUros Majstorovic <majstor@majstor.org>2022-01-19 02:49:47 +0100
commita4f22127be441c4c158c10fe65916872d99253d2 (patch)
tree0d476ce70c63b93ee2c4a2b3fafd0fa3df66b998 /ecp/test/init.c
parente356da0b15f8fef6559c7761a1b04b8f6e2dc649 (diff)
code cleanup
Diffstat (limited to 'ecp/test/init.c')
-rw-r--r--ecp/test/init.c15
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) {