From d8720e889c6f4e96681d6bc494db6171742e715a Mon Sep 17 00:00:00 2001 From: Richard Nyberg Date: Tue, 20 Sep 2005 19:04:39 +0000 Subject: [PATCH] Use the piece destructor. --- btpd/torrent.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/btpd/torrent.c b/btpd/torrent.c index d715346..3712b5b 100644 --- a/btpd/torrent.c +++ b/btpd/torrent.c @@ -171,12 +171,8 @@ torrent_unload(struct torrent *tp) peer = next; } - piece = BTPDQ_FIRST(&tp->getlst); - while (piece != NULL) { - struct piece *next = BTPDQ_NEXT(piece, entry); - free(piece); - piece = next; - } + while ((piece = BTPDQ_FIRST(&tp->getlst)) != NULL) + piece_free(piece); free(tp->piece_count); free(tp->busy_field);