Don't leak data center list when closing down telegram

This commit is contained in:
mjentsch 2014-09-04 22:07:25 +02:00
parent a7bb59a13a
commit 4f33201d09

View file

@ -195,6 +195,7 @@ struct telegram *telegram_new(struct dc *DC, const char* login, struct telegram_
}
void free_bl (struct binlog *bl);
void free_auth (struct dc* DC_list[], int count);
void telegram_destroy(struct telegram *this)
{
// close all open connections
@ -209,6 +210,7 @@ void telegram_destroy(struct telegram *this)
mtproto_free_closed (this);
free_bl (this->bl);
free_auth (this->auth.DC_list, 11);
g_free(this->login);
g_free(this->config_path);
@ -233,6 +235,14 @@ void free_bl (struct binlog *bl)
tfree (bl, sizeof (struct binlog));
}
void free_auth (struct dc* DC_list[], int count)
{
int i;
for (i = 0; i < count; i++ ) if (DC_list[i]) {
tfree (DC_list[i], sizeof(struct dc));
}
}
void assert_file_usable(const char *file)
{
logprintf ("assert_file_usable (%s)\n", file);