summaryrefslogtreecommitdiff
path: root/ecp/test/init_vconn.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_vconn.c
parente356da0b15f8fef6559c7761a1b04b8f6e2dc649 (diff)
code cleanup
Diffstat (limited to 'ecp/test/init_vconn.c')
-rw-r--r--ecp/test/init_vconn.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/ecp/test/init_vconn.c b/ecp/test/init_vconn.c
index b79aa3d..59e9517 100644
--- a/ecp/test/init_vconn.c
+++ b/ecp/test/init_vconn.c
@@ -15,16 +15,31 @@ static int v_rng(void *buf, size_t bufsize) {
return 0;
}
-static ECPConnection *conn_alloc(unsigned char type) {
+static ECPConnection *conn_alloc(ECPSocket *sock, unsigned char type) {
+ ECPConnection *conn;
+ int rv;
+
switch (type) {
case ECP_CTYPE_VCONN:
- return malloc(sizeof(ECPVConnIn));
+ conn = malloc(sizeof(ECPVConnIn));
+ break;
default:
- return malloc(sizeof(ECPConnection));
+ conn = malloc(sizeof(ECPConnection));
+ break;
+ }
+ if (conn == NULL) return NULL;
+
+ rv = ecp_conn_init(conn, sock, type);
+ if (rv) {
+ printf("free1\n");
+ free(conn);
+ return NULL;
}
+ return conn;
}
static void conn_free(ECPConnection *conn) {
+ printf("free2\n");
free(conn);
}