projects
/
project
/
uci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
52d8731
)
free uci_history entries properly
author
Felix Fietkau
<nbd@openwrt.org>
Wed, 30 Jan 2008 02:18:56 +0000
(
03:18
+0100)
committer
Felix Fietkau
<nbd@openwrt.org>
Wed, 30 Jan 2008 02:18:56 +0000
(
03:18
+0100)
file.c
patch
|
blob
|
history
list.c
patch
|
blob
|
history
diff --git
a/file.c
b/file.c
index
0a9b180
..
cb76d97
100644
(file)
--- a/
file.c
+++ b/
file.c
@@
-749,7
+749,7
@@
int uci_save(struct uci_context *ctx, struct uci_package *p)
fprintf(f, "\n");
else
fprintf(f, "=%s\n", h->value);
fprintf(f, "\n");
else
fprintf(f, "=%s\n", h->value);
- uci_
list_del(&e->list
);
+ uci_
free_history(h
);
}
done:
}
done:
diff --git
a/list.c
b/list.c
index
bd70857
..
88f07bd
100644
(file)
--- a/
list.c
+++ b/
list.c
@@
-173,7
+173,7
@@
uci_free_package(struct uci_package *p)
}
/* record a change that was done to a package */
}
/* 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_add_history(struct uci_context *ctx, struct uci_package *p, int cmd, char *section, char *option, char *value)
{
struct uci_history *h;
@@
-197,6
+197,19
@@
uci_add_history(struct uci_context *ctx, struct uci_package *p, int cmd, char *s
uci_list_add(&p->history, &h->e.list);
}
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;
static struct uci_element *uci_lookup_list(struct uci_context *ctx, struct uci_list *list, const char *name)
{
struct uci_element *e;