diff --git a/docs/reference/libsecret/libsecret-sections.txt b/docs/reference/libsecret/libsecret-sections.txt index a26fb83..d28e66f 100644 --- a/docs/reference/libsecret/libsecret-sections.txt +++ b/docs/reference/libsecret/libsecret-sections.txt @@ -109,8 +109,8 @@ secret_password_removev secret_password_remove_finish secret_password_remove_sync secret_password_removev_sync +secret_password_clear secret_password_free -
diff --git a/library/secret-password.c b/library/secret-password.c index bd5605c..6b3e22a 100644 --- a/library/secret-password.c +++ b/library/secret-password.c @@ -1125,3 +1125,18 @@ secret_password_free (gchar *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); +} diff --git a/library/secret-password.h b/library/secret-password.h index 8c95b6e..ca3fe44 100644 --- a/library/secret-password.h +++ b/library/secret-password.h @@ -126,6 +126,8 @@ gboolean secret_password_removev_sync (const SecretSchema *sche void secret_password_free (gchar *password); +void secret_password_clear (gchar *password); + G_END_DECLS #endif /* __SECRET_PASSWORD_H___ */