Add secret_password_clear() function
authorStef Walter <stefw@gnome.org>
Sun, 25 Mar 2012 10:18:24 +0000 (12:18 +0200)
committerStef Walter <stefw@gnome.org>
Sun, 25 Mar 2012 10:18:24 +0000 (12:18 +0200)
 * Useful for clearing passwords in memory

docs/reference/libsecret/libsecret-sections.txt
library/secret-password.c
library/secret-password.h

index a26fb8396392bc2086755f82026bf348ad8051c7..d28e66f357abb9e5456942f6e45c90bef5dfb5d6 100644 (file)
@@ -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
-
 </SECTION>
 
 <SECTION>
index bd5605c2e6fc46ccc10e5dd7df399f4aa29edc76..6b3e22a91cc0b0bdc064d8eb2a6c13da03e22d83 100644 (file)
@@ -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);
+}
index 8c95b6eb77e1c0eae8bd93a3a2f8b4d5b4b4b823..ca3fe44e2bb5c9ba06ae21c330b455b9d91f3b45 100644 (file)
@@ -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___ */