aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2016-02-21 10:15:50 +0200
committerSergey Poznyakoff <gray@gnu.org>2016-02-21 10:17:20 +0200
commitda6e295140fc1a1ef56db1c6f792e86793f7f2b1 (patch)
tree06a44c125b858f0b498555d722d2ab8f2f85fbf5 /src
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')
-rw-r--r--src/comp.c10
-rw-r--r--src/progman.c1
2 files changed, 9 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
@@ -463,15 +463,21 @@ component_config_commit (void)
struct component *comp, *match;
int prev = prev_index ();
size_t i;
/* 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 */
for (comp = list->head, i = 0; comp; comp = comp->next, i++)
{
match = complist_find_match (prev, comp);
diff --git a/src/progman.c b/src/progman.c
index 52c875f..a6202f3 100644
--- a/src/progman.c
+++ b/src/progman.c
@@ -171,12 +171,13 @@ destroy_prog (struct prog **pp)
switch (p->type)
{
case TYPE_COMPONENT:
component_ref_decr (p->v.p.comp);
if (p->v.p.status == status_listener && p->v.p.socket != -1)
deregister_socket (p->v.p.socket);
+ /* FIXME: Remove also all dependent progs (esp. tcpmux) */
break;
case TYPE_REDIRECTOR:
{
struct prog *master = p->v.r.master;
component_ref_decr (master->v.p.comp);

Return to:

Send suggestions and report system problems to the System administrator.