Fix segfaults on disconnect

This commit is contained in:
mjentsch 2014-10-14 18:59:04 +02:00
parent d5fb1601b7
commit 2b366fe1a8
2 changed files with 8 additions and 4 deletions

6
net.c
View file

@ -81,7 +81,11 @@ int ping_alarm (struct connection *c) {
}
void stop_ping_timer (struct connection *c) {
remove_event_timer (c->instance, &c->ev);
if (c->ev.self) {
remove_event_timer (c->instance, &c->ev);
} else {
warning ("trying to stop non-existing ping timer fd: #%d\n", c->fd);
}
}
void start_ping_timer (struct connection *c) {

View file

@ -206,9 +206,9 @@ void telegram_destroy(struct telegram *this)
g_free(this->secret_path);
// TODO: BN_CTX *ctx
free (this->phone_code_hash);
free (this->suser);
free (this->export_auth_str);
if (this->phone_code_hash) free (this->phone_code_hash);
if (this->suser) free (this->suser);
if (this->export_auth_str) free (this->export_auth_str);
//tfree (this->ML, sizeof(struct message) * MSG_STORE_SIZE);
tfree(this, sizeof(struct telegram));
}