]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/basic/util.c
Merge pull request #1619 from iaguis/nspawn-sysfs-netns-3
[thirdparty/systemd.git] / src / basic / util.c
index 460e74061a7383eb414683c79a93e7036731a7d0..3e90456dd3ef73de6221802d7ee1362f2a22e008 100644 (file)
@@ -6829,3 +6829,22 @@ bool fdname_is_valid(const char *s) {
 bool oom_score_adjust_is_valid(int oa) {
         return oa >= OOM_SCORE_ADJ_MIN && oa <= OOM_SCORE_ADJ_MAX;
 }
+
+void string_erase(char *x) {
+
+        if (!x)
+                return;
+
+        /* A delicious drop of snake-oil! To be called on memory where
+         * we stored passphrases or so, after we used them. */
+
+        memory_erase(x, strlen(x));
+}
+
+char *string_free_erase(char *s) {
+        if (!s)
+                return NULL;
+
+        string_erase(s);
+        return mfree(s);
+}