about summary refs log tree commit diff stats
path: root/src/stanza.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2013-01-23 22:24:54 +0000
committerJames Booth <boothj5@gmail.com>2013-01-23 22:24:54 +0000
commite2e805dd4fbfeadddc79d9b4063cfd04e341a7c4 (patch)
tree4b78767986051b0ac2b526fd87147456a602953b /src/stanza.c
parenta48b48b787fa1494e33703ed72a926100d6ee975 (diff)
downloadprofani-tty-e2e805dd4fbfeadddc79d9b4063cfd04e341a7c4.tar.gz
Tidied up memory allocation in capabilities
Diffstat (limited to 'src/stanza.c')
-rw-r--r--src/stanza.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/stanza.c b/src/stanza.c
index 012896ff..554dfc1c 100644
--- a/src/stanza.c
+++ b/src/stanza.c
@@ -581,6 +581,26 @@ stanza_create_form(xmpp_stanza_t * const stanza)
     return result;
 }
 
+void
+stanza_destroy_form(DataForm *form)
+{
+    if (form != NULL) {
+        FREE_SET_NULL(form->form_type);
+        if (form->fields != NULL) {
+            GSList *curr_field = form->fields;
+            while (curr_field != NULL) {
+                FormField *field = curr_field->data;
+                FREE_SET_NULL(field->var);
+                if ((field->values) != NULL) {
+                    g_slist_free_full(field->values, free);
+                }
+            }
+        }
+
+        form = NULL;
+    }
+}
+
 static int
 _field_compare(FormField *f1, FormField *f2)
 {