summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/useragent.c10
-rw-r--r--utils/useragent.h7
2 files changed, 17 insertions, 0 deletions
diff --git a/utils/useragent.c b/utils/useragent.c
index b528dce4f..3d93a97b2 100644
--- a/utils/useragent.c
+++ b/utils/useragent.c
@@ -78,3 +78,13 @@ user_agent_string(void)
return core_user_agent_string;
}
+/* Public API documented in useragent.h */
+void
+free_user_agent_string(void)
+{
+ if (core_user_agent_string != NULL) {
+ /* Nasty cast because we need to de-const it to free it */
+ free((void *)core_user_agent_string);
+ core_user_agent_string = NULL;
+ }
+}
diff --git a/utils/useragent.h b/utils/useragent.h
index 87677e7bc..6eb309a62 100644
--- a/utils/useragent.h
+++ b/utils/useragent.h
@@ -27,4 +27,11 @@
*/
const char * user_agent_string(void);
+/** Free any memory allocated for the user_agent_string
+ *
+ * After calling this, the value returned by \ref user_agent_string()
+ * is to be considered invalid.
+ */
+void free_user_agent_string(void);
+
#endif