fprintf(f, "\n");
else
fprintf(f, "=%s\n", h->value);
- uci_list_del(&e->list);
+ uci_free_history(h);
}
done:
}
/* record a change that was done to a package */
-static inline void
+static void
uci_add_history(struct uci_context *ctx, struct uci_package *p, int cmd, char *section, char *option, char *value)
{
struct uci_history *h;
uci_list_add(&p->history, &h->e.list);
}
+static void
+uci_free_history(struct uci_history *h)
+{
+ if (!h)
+ return;
+ if ((h->section != NULL) &&
+ (h->section != uci_dataptr(h))) {
+ free(h->section);
+ free(h->value);
+ }
+ uci_free_element(&h->e);
+}
+
static struct uci_element *uci_lookup_list(struct uci_context *ctx, struct uci_list *list, const char *name)
{
struct uci_element *e;