Browse Source

fix segfault

running list_del() twice will result in SEGFAULT
- first from connection.c:free_client() -> destroy_torrent()
- second from child_exit() -> destroy_torrent()

move list_del() to real cleanup after child was killed
master
Olaf Rempel 10 years ago
parent
commit
f8b9b57028
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      torrentfile.c

+ 3
- 3
torrentfile.c View File

@@ -77,9 +77,6 @@ struct torrent_file * find_create_torrent(const char *fullpath)

int destroy_torrent(struct torrent_file *torrent)
{
/* remove us from list */
list_del(&torrent->list);

/* check if we're still seeding, and deferr the destroy after sigchld */
if (torrent->child != NULL) {
torrent->destroy = 1;
@@ -89,6 +86,9 @@ int destroy_torrent(struct torrent_file *torrent)
return 0;
}

/* remove us from list */
list_del(&torrent->list);

free(torrent->name);
free(torrent);
return 0;


Loading…
Cancel
Save