Fixed small memory leaks
This commit is contained in:
parent
1789aa3cbf
commit
466aa0bd76
2
binlog.c
2
binlog.c
@ -266,6 +266,7 @@ static int fetch_comb_binlog_user_set_full_photo (void *extra) {
|
|||||||
tgls_free_photo (&U->user.photo);
|
tgls_free_photo (&U->user.photo);
|
||||||
}
|
}
|
||||||
tglf_fetch_photo (&U->user.photo);
|
tglf_fetch_photo (&U->user.photo);
|
||||||
|
U->flags |= FLAG_HAS_PHOTO;
|
||||||
|
|
||||||
if (tgl_state.callback.user_update) {
|
if (tgl_state.callback.user_update) {
|
||||||
tgl_state.callback.user_update ((void *)U, TGL_UPDATE_PHOTO);
|
tgl_state.callback.user_update ((void *)U, TGL_UPDATE_PHOTO);
|
||||||
@ -655,6 +656,7 @@ static int fetch_comb_binlog_chat_set_full_photo (void *extra) {
|
|||||||
tgls_free_photo (&C->chat.photo);
|
tgls_free_photo (&C->chat.photo);
|
||||||
}
|
}
|
||||||
tglf_fetch_photo (&C->chat.photo);
|
tglf_fetch_photo (&C->chat.photo);
|
||||||
|
C->flags |= FLAG_HAS_PHOTO;
|
||||||
|
|
||||||
if (tgl_state.callback.chat_update) {
|
if (tgl_state.callback.chat_update) {
|
||||||
tgl_state.callback.chat_update ((void *)C, TGL_UPDATE_PHOTO);
|
tgl_state.callback.chat_update ((void *)C, TGL_UPDATE_PHOTO);
|
||||||
|
2
main.c
2
main.c
@ -336,7 +336,7 @@ void parse_config (void) {
|
|||||||
strcpy (buf + l, "binlog_enabled");
|
strcpy (buf + l, "binlog_enabled");
|
||||||
config_lookup_bool (&conf, buf, &binlog_enabled);
|
config_lookup_bool (&conf, buf, &binlog_enabled);
|
||||||
|
|
||||||
int pfs_enabled;
|
int pfs_enabled = 0;
|
||||||
strcpy (buf + l, "pfs_enabled");
|
strcpy (buf + l, "pfs_enabled");
|
||||||
config_lookup_bool (&conf, buf, &pfs_enabled);
|
config_lookup_bool (&conf, buf, &pfs_enabled);
|
||||||
if (pfs_enabled) {
|
if (pfs_enabled) {
|
||||||
|
@ -1476,7 +1476,6 @@ void tgls_free_photo_size (struct tgl_photo_size *S) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tgls_free_photo (struct tgl_photo *P) {
|
void tgls_free_photo (struct tgl_photo *P) {
|
||||||
if (!P->access_hash) { return; }
|
|
||||||
if (P->caption) { tfree_str (P->caption); }
|
if (P->caption) { tfree_str (P->caption); }
|
||||||
if (P->sizes) {
|
if (P->sizes) {
|
||||||
int i;
|
int i;
|
||||||
@ -1488,12 +1487,18 @@ void tgls_free_photo (struct tgl_photo *P) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void tgls_free_video (struct tgl_video *V) {
|
void tgls_free_video (struct tgl_video *V) {
|
||||||
|
tfree_str (V->mime_type);
|
||||||
if (!V->access_hash) { return; }
|
if (!V->access_hash) { return; }
|
||||||
tfree_str (V->caption);
|
tfree_str (V->caption);
|
||||||
tgls_free_photo_size (&V->thumb);
|
tgls_free_photo_size (&V->thumb);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tgls_free_audio (struct tgl_audio *A) {
|
||||||
|
tfree_str (A->mime_type);
|
||||||
|
}
|
||||||
|
|
||||||
void tgls_free_document (struct tgl_document *D) {
|
void tgls_free_document (struct tgl_document *D) {
|
||||||
|
tfree_str (D->mime_type);
|
||||||
if (!D->access_hash) { return; }
|
if (!D->access_hash) { return; }
|
||||||
tfree_str (D->caption);
|
tfree_str (D->caption);
|
||||||
tfree_str (D->mime_type);
|
tfree_str (D->mime_type);
|
||||||
@ -1504,7 +1509,9 @@ void tgls_free_message_media (struct tgl_message_media *M) {
|
|||||||
switch (M->type) {
|
switch (M->type) {
|
||||||
case tgl_message_media_none:
|
case tgl_message_media_none:
|
||||||
case tgl_message_media_geo:
|
case tgl_message_media_geo:
|
||||||
|
return;
|
||||||
case tgl_message_media_audio:
|
case tgl_message_media_audio:
|
||||||
|
tgls_free_audio (&M->audio);
|
||||||
return;
|
return;
|
||||||
case tgl_message_media_photo:
|
case tgl_message_media_photo:
|
||||||
tgls_free_photo (&M->photo);
|
tgls_free_photo (&M->photo);
|
||||||
|
Loading…
Reference in New Issue
Block a user