From 70c6c3571b5250b7cabfad3d20d4f7c09a5aadaf Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Sun, 20 Feb 2005 19:47:17 +0000 Subject: [PATCH] rcorder tries real hard to free things while processing the list but this not only slows it down unnecessarily, it can also result in a double-free when certain circular dependancies are encountered. Remove the free()'s causing the problem. Reported-by: Gary Allan --- sbin/rcorder/rcorder.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/sbin/rcorder/rcorder.c b/sbin/rcorder/rcorder.c index 8512519ace..5b69514836 100644 --- a/sbin/rcorder/rcorder.c +++ b/sbin/rcorder/rcorder.c @@ -31,7 +31,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $NetBSD: rcorder.c,v 1.7 2000/08/04 07:33:55 enami Exp $ - * $DragonFly: src/sbin/rcorder/rcorder.c,v 1.6 2004/02/04 17:40:01 joerg Exp $ + * $DragonFly: src/sbin/rcorder/rcorder.c,v 1.7 2005/02/20 19:47:17 dillon Exp $ */ #include @@ -703,6 +703,10 @@ keep_ok(filenode *fnode) * is ok, we loop over the filenodes requirements, calling satisfy_req() * for each of them.. once we have done this, remove this filenode * from each provision table, as we are now done. + * + * NOTE: do_file() is called recursively from several places and cannot + * safely free() anything related to items that may be recursed on. + * Circular dependancies will cause problems if we do. */ void do_file(filenode *fnode) @@ -737,7 +741,7 @@ do_file(filenode *fnode) r_tmp = r; satisfy_req(r, fnode->filename); r = r->next; - free(r_tmp); + /*free(r_tmp);*/ } fnode->req_list = NULL; @@ -776,8 +780,8 @@ do_file(filenode *fnode) } DPRINTF((stderr, "nuking %s\n", fnode->filename)); - free(fnode->filename); - free(fnode); + /*free(fnode->filename);*/ + /*free(fnode);*/ } void -- 2.41.0