SilcClientConnection conn;
SilcFSMThread thread;
- if (!callback)
+ if (!client || !callback || !remote_host)
return NULL;
SILC_LOG_DEBUG(("Adding new connection to %s:%d", remote_host, port));
conn->internal = silc_calloc(1, sizeof(*conn->internal));
if (!conn->internal) {
+ silc_free(conn->remote_host);
silc_free(conn);
return NULL;
}
silc_atomic_init16(&conn->internal->cmd_ident, 0);
if (!silc_hash_alloc("sha1", &conn->internal->sha1hash)) {
- silc_free(conn);
+ silc_free(conn->remote_host);
silc_free(conn->internal);
+ silc_free(conn);
return NULL;
}
if (!silc_identifier_verify(username, strlen(username),
SILC_STRING_UTF8, 128)) {
SILC_LOG_ERROR(("Malformed username '%s'. Username must be UTF-8 string",
- client->username));
+ username));
return FALSE;
}
if (!silc_identifier_verify(hostname, strlen(hostname),
SILC_STRING_UTF8, 256)) {
SILC_LOG_ERROR(("Malformed hostname '%s'. Hostname must be UTF-8 string",
- client->hostname));
+ hostname));
return FALSE;
}
if (!silc_utf8_valid(realname, strlen(realname))) {
SILC_LOG_ERROR(("Malformed realname '%s'. Realname must be UTF-8 string",
- client->realname));
+ realname));
return FALSE;
}