1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-02 15:53:12 +02:00

core: free secured data on exit

This commit is contained in:
Sebastien Helleu
2013-11-23 16:29:51 +01:00
parent 0b94d3c3bc
commit 1fa4701ed0
3 changed files with 26 additions and 0 deletions
+24
View File
@@ -1336,3 +1336,27 @@ secure_buffer_open ()
secure_buffer_display ();
}
/*
* Frees all allocated data.
*/
void
secure_end ()
{
if (secure_passphrase)
{
free (secure_passphrase);
secure_passphrase = NULL;
}
if (secure_hashtable_data)
{
hashtable_free (secure_hashtable_data);
secure_hashtable_data = NULL;
}
if (secure_hashtable_data_encrypted)
{
hashtable_free (secure_hashtable_data_encrypted);
secure_hashtable_data_encrypted = NULL;
}
}
+1
View File
@@ -66,5 +66,6 @@ extern void secure_free ();
extern void secure_buffer_display ();
extern void secure_buffer_assign ();
extern void secure_buffer_open ();
extern void secure_end ();
#endif /* __WEECHAT_SECURE_H */
+1
View File
@@ -490,6 +490,7 @@ main (int argc, char *argv[])
unhook_all (); /* remove all hooks */
hdata_end (); /* end hdata */
eval_end (); /* end eval */
secure_end (); /* end secured data */
string_end (); /* end string */
weechat_shutdown (EXIT_SUCCESS, 0); /* quit WeeChat (oh no, why?) */