summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-04-11 01:16:02 +0200
committerFelix Fietkau <nbd@openwrt.org>2009-04-11 01:16:02 +0200
commit07c562eab5fc23db18fb472171415b732fbe4cae (patch)
tree427437ddd1d7c5944bf6909e850c03a9d4c68964
parent25e6437875b2953f6b5706359e17db84334e7877 (diff)
downloaduci-07c562eab5fc23db18fb472171415b732fbe4cae.tar.gz
fix const related compile error with newer gcc
-rw-r--r--ucimap.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ucimap.c b/ucimap.c
index 9306036..dddbafc 100644
--- a/ucimap.c
+++ b/ucimap.c
@@ -255,6 +255,7 @@ ucimap_parse_section(struct uci_map *map, struct uci_sectmap *sm, struct uci_sec
{
struct uci_sectmap_data *sd = NULL;
void *section = NULL;
+ char *section_name;
int err;
sd = malloc(sm->alloc_len + sizeof(struct uci_sectmap_data));
@@ -270,16 +271,18 @@ ucimap_parse_section(struct uci_map *map, struct uci_sectmap *sm, struct uci_sec
if (!sd->allocmap)
goto error_mem;
- sd->section_name = strdup(s->e.name);
- if (!sd->section_name)
+ section_name = strdup(s->e.name);
+ if (!section_name)
goto error_mem;
+ sd->section_name = section_name;
+
sd->cmap = malloc(BITFIELD_SIZE(sm->n_options));
if (!sd->cmap)
goto error_mem;
memset(sd->cmap, 0, BITFIELD_SIZE(sm->n_options));
- ucimap_add_alloc(&sd->allocmap[sd->allocmap_len++], (void *)sd->section_name);
+ ucimap_add_alloc(&sd->allocmap[sd->allocmap_len++], (void *)section_name);
ucimap_add_alloc(&sd->allocmap[sd->allocmap_len++], (void *)sd->cmap);
section = (char *)sd + sizeof(struct uci_sectmap_data);