diff options
| -rw-r--r-- | btpd/torrent.c | 8 |
1 files 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); |