summaryrefslogtreecommitdiffabout
path: root/src/comp.c
authorSergey Poznyakoff <gray@gnu.org>2016-02-21 08:15:50 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2016-02-21 08:17:20 (GMT)
commitda6e295140fc1a1ef56db1c6f792e86793f7f2b1 (patch) (side-by-side diff)
tree06a44c125b858f0b498555d722d2ab8f2f85fbf5 /src/comp.c
parent5ba46aeec2900c23a0c260093daf56180f1180c0 (diff)
downloadpies-da6e295140fc1a1ef56db1c6f792e86793f7f2b1.tar.gz
pies-da6e295140fc1a1ef56db1c6f792e86793f7f2b1.tar.bz2
Bugfix
* src/comp.c (component_config_commit): Correctly handle empty list of components.
Diffstat (limited to 'src/comp.c') (more/less context) (ignore whitespace changes)
-rw-r--r--src/comp.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/comp.c b/src/comp.c
index b340abe..5ddac36 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -466,9 +466,15 @@ component_config_commit (void)
/* Count available components and allocate array for them */
for (comp = list->head, i = 0; comp; comp = comp->next, i++)
- /* FIXME: component_compute_prereq (comp) */;
+ /* nothing */;
- comp_array = grecs_realloc (comp_array, i * sizeof (comp_array[0]));
+ if (i == 0)
+ {
+ free (comp_array);
+ comp_array = NULL;
+ }
+ else
+ comp_array = grecs_realloc (comp_array, i * sizeof (comp_array[0]));
comp_count = i;
/* Rearrange components, registering prog entries for the new ones */

Return to:

Send suggestions and report system problems to the System administrator.