Add secret_password_clear() function

* Useful for clearing passwords in memory
This commit is contained in:
Stef Walter 2012-03-25 12:18:24 +02:00
parent dd83ac0db3
commit de403fd927
3 changed files with 18 additions and 1 deletions

View File

@ -109,8 +109,8 @@ secret_password_removev
secret_password_remove_finish secret_password_remove_finish
secret_password_remove_sync secret_password_remove_sync
secret_password_removev_sync secret_password_removev_sync
secret_password_clear
secret_password_free secret_password_free
</SECTION> </SECTION>
<SECTION> <SECTION>

View File

@ -1125,3 +1125,18 @@ secret_password_free (gchar *password)
egg_secure_strfree (password); egg_secure_strfree (password);
} }
/**
* secret_password_clear:
* @password: (allow-none): password to clear
*
* Clear the memory used by a password.
*/
void
secret_password_clear (gchar *password)
{
if (password == NULL)
return;
egg_secure_strclear (password);
}

View File

@ -126,6 +126,8 @@ gboolean secret_password_removev_sync (const SecretSchema *sche
void secret_password_free (gchar *password); void secret_password_free (gchar *password);
void secret_password_clear (gchar *password);
G_END_DECLS G_END_DECLS
#endif /* __SECRET_PASSWORD_H___ */ #endif /* __SECRET_PASSWORD_H___ */