diff options
Diffstat (limited to 'src/trackerlogic.c')
| -rw-r--r-- | src/trackerlogic.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/trackerlogic.c b/src/trackerlogic.c index d25ddac..7e8d969 100644 --- a/src/trackerlogic.c +++ b/src/trackerlogic.c | |||
| @@ -65,14 +65,12 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time age, size_t down_c | |||
| 65 | memset(torrent, 0, sizeof(ot_torrent)); | 65 | memset(torrent, 0, sizeof(ot_torrent)); |
| 66 | memcpy(torrent->hash, hash, sizeof(ot_hash)); | 66 | memcpy(torrent->hash, hash, sizeof(ot_hash)); |
| 67 | 67 | ||
| 68 | if (!(torrent->peer_list6 = malloc(sizeof(ot_peerlist))) || !(torrent->peer_list4 = malloc(sizeof(ot_peerlist)))) { | 68 | if (!(torrent->peer_list6 = calloc(1, sizeof(ot_peerlist))) || !(torrent->peer_list4 = calloc(1, sizeof(ot_peerlist)))) { |
| 69 | vector_remove_torrent(torrents_list, torrent); | 69 | vector_remove_torrent(torrents_list, torrent); |
| 70 | mutex_bucket_unlock_by_hash(hash, 0); | 70 | mutex_bucket_unlock_by_hash(hash, 0); |
| 71 | return; | 71 | return; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | memset(torrent->peer_list6, 0, sizeof(ot_peerlist)); | ||
| 75 | memset(torrent->peer_list4, 0, sizeof(ot_peerlist)); | ||
| 76 | torrent->peer_list6->base = time_now_minutes() - age; | 74 | torrent->peer_list6->base = time_now_minutes() - age; |
| 77 | torrent->peer_list4->base = time_now_minutes() - age; | 75 | torrent->peer_list4->base = time_now_minutes() - age; |
| 78 | torrent->peer_list6->down_count = down_count; | 76 | torrent->peer_list6->down_count = down_count; |
| @@ -110,14 +108,12 @@ size_t add_peer_to_torrent_and_return_peers(PROTO_FLAG proto, struct ot_workstru | |||
| 110 | memset(torrent, 0, sizeof(ot_torrent)); | 108 | memset(torrent, 0, sizeof(ot_torrent)); |
| 111 | memcpy(torrent->hash, *ws->hash, sizeof(ot_hash)); | 109 | memcpy(torrent->hash, *ws->hash, sizeof(ot_hash)); |
| 112 | 110 | ||
| 113 | if (!(torrent->peer_list6 = malloc(sizeof(ot_peerlist))) || !(torrent->peer_list4 = malloc(sizeof(ot_peerlist)))) { | 111 | if (!(torrent->peer_list6 = calloc(1, sizeof(ot_peerlist))) || !(torrent->peer_list4 = calloc(1, sizeof(ot_peerlist)))) { |
| 114 | vector_remove_torrent(torrents_list, torrent); | 112 | vector_remove_torrent(torrents_list, torrent); |
| 115 | mutex_bucket_unlock_by_hash(*ws->hash, 0); | 113 | mutex_bucket_unlock_by_hash(*ws->hash, 0); |
| 116 | return 0; | 114 | return 0; |
| 117 | } | 115 | } |
| 118 | 116 | ||
| 119 | memset(torrent->peer_list6, 0, sizeof(ot_peerlist)); | ||
| 120 | memset(torrent->peer_list4, 0, sizeof(ot_peerlist)); | ||
| 121 | delta_torrentcount = 1; | 117 | delta_torrentcount = 1; |
| 122 | } else | 118 | } else |
| 123 | clean_single_torrent(torrent); | 119 | clean_single_torrent(torrent); |
