diff --git a/net.c b/net.c index bc0c7aa..f4a17d5 100644 --- a/net.c +++ b/net.c @@ -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) { diff --git a/telegram.c b/telegram.c index 6999e9a..0bd80d3 100755 --- a/telegram.c +++ b/telegram.c @@ -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)); }