Don't leak data center list when closing down telegram
This commit is contained in:
parent
a7bb59a13a
commit
4f33201d09
1 changed files with 10 additions and 0 deletions
10
telegram.c
10
telegram.c
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue