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);
|
||||
}
|
||||
tglf_fetch_photo (&U->user.photo);
|
||||
U->flags |= FLAG_HAS_PHOTO;
|
||||
|
||||
if (tgl_state.callback.user_update) {
|
||||
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);
|
||||
}
|
||||
tglf_fetch_photo (&C->chat.photo);
|
||||
C->flags |= FLAG_HAS_PHOTO;
|
||||
|
||||
if (tgl_state.callback.chat_update) {
|
||||
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");
|
||||
config_lookup_bool (&conf, buf, &binlog_enabled);
|
||||
|
||||
int pfs_enabled;
|
||||
int pfs_enabled = 0;
|
||||
strcpy (buf + l, "pfs_enabled");
|
||||
config_lookup_bool (&conf, buf, &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) {
|
||||
if (!P->access_hash) { return; }
|
||||
if (P->caption) { tfree_str (P->caption); }
|
||||
if (P->sizes) {
|
||||
int i;
|
||||
@ -1488,12 +1487,18 @@ void tgls_free_photo (struct tgl_photo *P) {
|
||||
}
|
||||
|
||||
void tgls_free_video (struct tgl_video *V) {
|
||||
tfree_str (V->mime_type);
|
||||
if (!V->access_hash) { return; }
|
||||
tfree_str (V->caption);
|
||||
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) {
|
||||
tfree_str (D->mime_type);
|
||||
if (!D->access_hash) { return; }
|
||||
tfree_str (D->caption);
|
||||
tfree_str (D->mime_type);
|
||||
@ -1504,7 +1509,9 @@ void tgls_free_message_media (struct tgl_message_media *M) {
|
||||
switch (M->type) {
|
||||
case tgl_message_media_none:
|
||||
case tgl_message_media_geo:
|
||||
return;
|
||||
case tgl_message_media_audio:
|
||||
tgls_free_audio (&M->audio);
|
||||
return;
|
||||
case tgl_message_media_photo:
|
||||
tgls_free_photo (&M->photo);
|
||||
|
Loading…
Reference in New Issue
Block a user