projects
/
project
/
uci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lua: include /opt/local/lib and /opt/local/include in the search path on mac os x
[project/uci.git]
/
ucimap.c
diff --git
a/ucimap.c
b/ucimap.c
index
140c684
..
776a304
100644
(file)
--- a/
ucimap.c
+++ b/
ucimap.c
@@
-162,9
+162,10
@@
ucimap_free_section(struct uci_map *map, struct ucimap_section_data *sd)
void
ucimap_cleanup(struct uci_map *map)
{
void
ucimap_cleanup(struct uci_map *map)
{
- struct ucimap_section_data *sd;
+ struct ucimap_section_data *sd
, *sd_next
;
- for (sd = map->sdata; sd; sd = sd->next) {
+ for (sd = map->sdata; sd; sd = sd_next) {
+ sd_next = sd->next;
ucimap_free_section(map, sd);
}
}
ucimap_free_section(map, sd);
}
}
@@
-274,6
+275,8
@@
ucimap_resize_list(struct ucimap_section_data *sd, struct ucimap_list **list, in
if (!*list) {
new = calloc(1, size);
if (!*list) {
new = calloc(1, size);
+ if (!new)
+ return -ENOMEM;
ucimap_add_alloc(sd, new);
goto set;
ucimap_add_alloc(sd, new);
goto set;
@@
-292,6
+295,9
@@
realloc:
offset = (items - (*list)->size) * sizeof(union ucimap_data);
a->ptr = realloc(a->ptr, size);
offset = (items - (*list)->size) * sizeof(union ucimap_data);
a->ptr = realloc(a->ptr, size);
+ if (!a->ptr)
+ return -ENOMEM;
+
if (offset)
memset((char *) a->ptr + offset, 0, size - offset);
new = a->ptr;
if (offset)
memset((char *) a->ptr + offset, 0, size - offset);
new = a->ptr;
@@
-308,6
+314,7
@@
ucimap_add_fixup(struct ucimap_section_data *sd, union ucimap_data *data, struct
struct ucimap_fixup *f, tmp;
struct uci_map *map = sd->map;
struct ucimap_fixup *f, tmp;
struct uci_map *map = sd->map;
+ tmp.next = NULL;
tmp.sm = om->data.sm;
tmp.name = str;
tmp.type = om->type;
tmp.sm = om->data.sm;
tmp.name = str;
tmp.type = om->type;
@@
-706,6
+713,8
@@
ucimap_parse_section(struct uci_map *map, struct uci_sectionmap *sm, struct ucim
return 0;
error_mem:
return 0;
error_mem:
+ if (sd->alloc_custom)
+ free(sd->alloc_custom);
if (sd->allocmap)
free(sd->allocmap);
free(sd);
if (sd->allocmap)
free(sd->allocmap);
free(sd);