From: Jeremy Allison Date: Thu, 11 Feb 2010 00:23:33 +0000 (-0800) Subject: Fix bad use when freeing linked list. Todd Stecher (Original author) please check ! X-Git-Tag: samba-3.6.0pre1~5464 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed0e0a20059aeadddd69c4618d35dfb3aca69ba4;p=thirdparty%2Fsamba.git Fix bad use when freeing linked list. Todd Stecher (Original author) please check ! Jeremy. --- diff --git a/source3/modules/perfcount_test.c b/source3/modules/perfcount_test.c index f9ea817127b..67be4aa9c61 100644 --- a/source3/modules/perfcount_test.c +++ b/source3/modules/perfcount_test.c @@ -176,12 +176,14 @@ static void perfcount_test_dump_counters(void) DEBUG(0,("##### Dumping Performance Counters #####\n")); - for (i=0; i < 256; i++) { - for (head = g_list[i]; head != NULL; head = head->next) { - perfcount_test_dump_counter(head, 0); - SAFE_FREE(DLIST_PREV(head)); - } - SAFE_FREE(head); + for (i=0; i < MAX_OP; i++) { + struct perfcount_test_counter *next; + for (head = g_list[i]; head != NULL; head = next) { + next = head->next; + perfcount_test_dump_counter(head, 0); + SAFE_FREE(head); + } + g_list[i] = NULL; } }