summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/form.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/render/form.c b/render/form.c
index a2b661e39..34029df44 100644
--- a/render/form.c
+++ b/render/form.c
@@ -215,6 +215,7 @@ void form_add_control(struct form *form, struct form_control *control)
*/
void form_free_control(struct form_control *control)
{
+ struct form_control *c;
assert(control != NULL);
LOG(("Control:%p name:%p value:%p initial:%p", control, control->name, control->value, control->initial_value));
@@ -251,6 +252,24 @@ void form_free_control(struct form_control *control)
}
}
+ /* unlink the control from the form */
+ for (c = control->form->controls; c != NULL; c = c->next) {
+ if (c->next == control) {
+ c->next = control->next;
+ if (control->form->last_control == control)
+ control->form->last_control = c;
+ break;
+ }
+ if (c == control) {
+ /* can only happen if control was first control */
+ control->form->controls = control->next;
+ if (control->form->last_control == control)
+ control->form->controls =
+ control->form->last_control = NULL;
+ break;
+ }
+ }
+
free(control);
}