summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/include/k5-int.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index d119d02be..670915d74 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -675,6 +675,16 @@ zapfree(void *ptr, size_t len)
}
}
+/* Convenience function: zap and free zero-terminated str if it is non-NULL. */
+static inline void
+zapfreestr(void *str)
+{
+ if (str != NULL) {
+ zap(str, strlen((char *)str));
+ free(str);
+ }
+}
+
/*
* Combine two keys (normally used by the hardware preauth mechanism)
*/