Index: ossp-pkg/ex/ChangeLog RCS File: /v/ossp/cvs/ossp-pkg/ex/ChangeLog,v rcsdiff -q -kk '-r1.6' '-r1.7' -u '/v/ossp/cvs/ossp-pkg/ex/ChangeLog,v' 2>/dev/null --- ChangeLog 2003/01/30 10:59:34 1.6 +++ ChangeLog 2003/02/09 18:15:33 1.7 @@ -11,6 +11,14 @@ This is the list of all changes to the OSSP ex source tree. + Changes between 1.0.2 and 1.0.3 (30-Jan-2003 to xx-Feb-2003) + + *) Fixed test suite library (ts.c): the ts_suite_free() + function performed an illegal iteration for freeing elements (they + were freed but still references for traversing to next element). + This is now solved by a look-ahead traversion. + [Ralf S. Engelschall, Brian T. Egleston ] + Changes between 1.0.1 and 1.0.2 (06-Jan-2003 to 30-Jan-2003) *) Polished and enhanced the manual page ex(3). Index: ossp-pkg/ex/ts.c RCS File: /v/ossp/cvs/ossp-pkg/ex/ts.c,v rcsdiff -q -kk '-r1.3' '-r1.4' -u '/v/ossp/cvs/ossp-pkg/ex/ts.c,v' 2>/dev/null --- ts.c 2003/01/30 11:04:42 1.3 +++ ts.c 2003/02/09 18:15:34 1.4 @@ -2,7 +2,7 @@ ** TS - OSSP Test Suite Library ** Copyright (c) 2001-2002 Ralf S. Engelschall ** Copyright (c) 2001-2002 The OSSP Project -** Copyright (c) 2001-2002 Cable & Wireless Germany +** Copyright (c) 2001-2002 Cable & Wireless Deutschland ** ** This file is part of OSSP TS, a small test suite library which ** can be found at http://www.ossp.org/pkg/ts/. @@ -76,6 +76,10 @@ for ((ep) = RING_FIRST((hp)); \ (ep) != RING_SENTINEL((hp), elem, link); \ (ep) = RING_NEXT((ep), link)) +#define RING_FOREACH_LA(ep, epT, hp, elem, link) \ + for ((ep) = RING_FIRST((hp)), (epT) = RING_NEXT((ep), link); \ + (ep) != RING_SENTINEL((hp), elem, link); \ + (ep) = (epT), (epT) = RING_NEXT((epT), link)) /* test suite test log */ struct tstl_st; @@ -126,7 +130,7 @@ int n; int bytes; - if (format == NULL || ap == NULL) + if (format == NULL) return -1; bytes = 0; while (*format != '\0') { @@ -200,7 +204,7 @@ int n; va_list ap2; - if (format == NULL || ap == NULL) + if (format == NULL) return NULL; ap2 = ap; if ((n = ts_suite_mvxprintf(NULL, 0, format, ap)) == -1) @@ -367,15 +371,15 @@ /* destroy test suite */ void ts_suite_free(ts_suite_t *ts) { - ts_test_t *tst; - tstc_t *tstc; - tstl_t *tstl; + ts_test_t *tst, *tstT; + tstc_t *tstc, *tstcT; + tstl_t *tstl, *tstlT; if (ts == NULL) return; - RING_FOREACH(tst, &ts->tests, ts_test_t, next) { - RING_FOREACH(tstc, &tst->checks, tstc_t, next) { - RING_FOREACH(tstl, &tstc->logs, tstl_t, next) { + RING_FOREACH_LA(tst, tstT, &ts->tests, ts_test_t, next) { + RING_FOREACH_LA(tstc, tstcT, &tst->checks, tstc_t, next) { + RING_FOREACH_LA(tstl, tstlT, &tstc->logs, tstl_t, next) { free(tstl->text); } free(tstc->title);