diff --git a/lib/com_err/error.c b/lib/com_err/error.c index ca8953a5b..51a28b7f4 100644 --- a/lib/com_err/error.c +++ b/lib/com_err/error.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan + * Copyright (c) 1997, 1998, 2001 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -62,9 +62,9 @@ initialize_error_table_r(struct et_list **list, int num_errors, long base) { - struct et_list *et; + struct et_list *et, **end; struct foobar *f; - for (et = *list; et; et = et->next) + for (end = list, et = *list; et; end = &et->next, et = et->next) if (et->table->msgs == messages) return; f = malloc(sizeof(*f)); @@ -75,8 +75,8 @@ initialize_error_table_r(struct et_list **list, et->table->msgs = messages; et->table->n_msgs = num_errors; et->table->base = base; - et->next = *list; - *list = et; + et->next = NULL; + *end = et; }