aboutsummaryrefslogtreecommitdiffstats
path: root/src/omemo
diff options
context:
space:
mode:
authorMichael Vetter <jubalh@iodoru.org>2019-07-04 10:30:56 +0200
committerMichael Vetter <jubalh@iodoru.org>2019-07-04 10:30:56 +0200
commit199162b11afe0e5275f62c65fc82a5bbcc6c9552 (patch)
treee78d0538b1480ccab2230bc3fad1afbcc2d7028a /src/omemo
parent46ecdc335c61c5adf98894c927bd490ae862b306 (diff)
downloadprofani-tty-199162b11afe0e5275f62c65fc82a5bbcc6c9552.tar.gz
Add omemo_close function
We call omemo_init() when starting profanity and should have an omemo_close() at exit. For now we free the fingerprint autocompleter in there. Fixes valgrind: ``` ==13226== 24 bytes in 1 blocks are definitely lost in loss record 2,855 of 6,958 ==13226== at 0x483677F: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==13226== by 0x48AD39: autocomplete_new (autocomplete.c:57) ==13226== by 0x4AB89F: omemo_init (omemo.c:127) ==13226== by 0x42C283: _init (profanity.c:206) ==13226== by 0x42BFF3: prof_run (profanity.c:98) ==13226== by 0x4B25E6: main (main.c:172) ``` Regards https://github.com/profanity-im/profanity/issues/1131
Diffstat (limited to 'src/omemo')
-rw-r--r--src/omemo/omemo.c9
-rw-r--r--src/omemo/omemo.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/src/omemo/omemo.c b/src/omemo/omemo.c
index 96d2d65a..c813dcf0 100644
--- a/src/omemo/omemo.c
+++ b/src/omemo/omemo.c
@@ -128,6 +128,15 @@ omemo_init(void)
}
void
+omemo_close(void)
+{
+ if (omemo_ctx.fingerprint_ac) {
+ autocomplete_free(omemo_ctx.fingerprint_ac);
+ omemo_ctx.fingerprint_ac = NULL;
+ }
+}
+
+void
omemo_on_connect(ProfAccount *account)
{
GError *error = NULL;
diff --git a/src/omemo/omemo.h b/src/omemo/omemo.h
index ae25b5ba..abe21be5 100644
--- a/src/omemo/omemo.h
+++ b/src/omemo/omemo.h
@@ -56,6 +56,7 @@ typedef struct omemo_key {
} omemo_key_t;
void omemo_init(void);
+void omemo_close(void);
void omemo_on_connect(ProfAccount *account);
void omemo_on_disconnect(void);
void omemo_generate_crypto_materials(ProfAccount *account);