diff --git a/binlog.c b/binlog.c index 0da050e..4f37f53 100644 --- a/binlog.c +++ b/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); diff --git a/main.c b/main.c index a7a5ebb..de35bc0 100644 --- a/main.c +++ b/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) { diff --git a/structures.c b/structures.c index 2e3dec0..f8c82c9 100644 --- a/structures.c +++ b/structures.c @@ -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);