]>
Commit | Line | Data |
---|---|---|
2056dd30 AM |
1 | From 6207fce91a0933e852ec76fc31ca81ec00ffa04b Mon Sep 17 00:00:00 2001 |
2 | From: Wilfried Goesgens <dothebart@citadel.org> | |
3 | Date: Thu, 5 Jun 2014 20:04:13 +0200 | |
4 | Subject: [PATCH 11/22] Configparser: when we alocate an empty list, we also | |
5 | need to reset the counter; else we will trip over this later. This fixes | |
6 | https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=750440 | |
7 | ||
8 | --- | |
9 | src/configfile.c | 9 ++++++++- | |
10 | 1 file changed, 8 insertions(+), 1 deletion(-) | |
11 | ||
12 | diff --git a/src/configfile.c b/src/configfile.c | |
13 | index 0b7786f..983d995 100644 | |
14 | --- a/src/configfile.c | |
15 | +++ b/src/configfile.c | |
16 | @@ -414,6 +414,12 @@ static int cf_ci_replace_child (oconfig_item_t *dst, oconfig_item_t *src, | |
17 | ||
18 | /* Resize the memory containing the children to be big enough to hold | |
19 | * all children. */ | |
20 | + if (dst->children_num + src->children_num - 1 == 0) | |
21 | + { | |
22 | + dst->children_num = 0; | |
23 | + return (0); | |
24 | + } | |
25 | + | |
26 | temp = (oconfig_item_t *) realloc (dst->children, | |
27 | sizeof (oconfig_item_t) | |
28 | * (dst->children_num + src->children_num - 1)); | |
29 | @@ -514,7 +520,8 @@ static int cf_include_all (oconfig_item_t *root, int depth) | |
30 | continue; | |
31 | ||
32 | /* Now replace the i'th child in `root' with `new'. */ | |
33 | - cf_ci_replace_child (root, new, i); | |
34 | + if (cf_ci_replace_child (root, new, i) < 0) | |
35 | + return (-1); | |
36 | ||
37 | /* ... and go back to the new i'th child. */ | |
38 | --i; | |
39 | -- | |
40 | 1.9.3 | |
41 |