summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ot_vector.c2
-rw-r--r--trackerlogic.c4
2 files changed, 2 insertions, 4 deletions
diff --git a/ot_vector.c b/ot_vector.c
index e3c3d3f..c4cd171 100644
--- a/ot_vector.c
+++ b/ot_vector.c
@@ -156,8 +156,6 @@ void vector_remove_torrent(ot_vector *vector, ot_torrent *match) {
156 if (!vector->size) 156 if (!vector->size)
157 return; 157 return;
158 158
159 /* If this is being called after a unsuccessful malloc() for peer_list
160 in add_peer_to_torrent, match->peer_list actually might be NULL */
161 free_peerlist(match->peer_list6); 159 free_peerlist(match->peer_list6);
162 free_peerlist(match->peer_list4); 160 free_peerlist(match->peer_list4);
163 161
diff --git a/trackerlogic.c b/trackerlogic.c
index f5e3dc0..db1d787 100644
--- a/trackerlogic.c
+++ b/trackerlogic.c
@@ -31,8 +31,8 @@
31/* Forward declaration */ 31/* Forward declaration */
32size_t return_peers_for_torrent(struct ot_workstruct *ws, ot_torrent *torrent, size_t amount, char *reply, PROTO_FLAG proto); 32size_t return_peers_for_torrent(struct ot_workstruct *ws, ot_torrent *torrent, size_t amount, char *reply, PROTO_FLAG proto);
33 33
34void free_peerlist(ot_peerlist *peer_list) { 34void free_peerlist(ot_peerlist *peer_list) {
35 if (peer_list->peers.data) { 35 if (peer_list && peer_list->peers.data) {
36 if (OT_PEERLIST_HASBUCKETS(peer_list)) 36 if (OT_PEERLIST_HASBUCKETS(peer_list))
37 vector_clean_list((ot_vector *)peer_list->peers.data, peer_list->peers.size); 37 vector_clean_list((ot_vector *)peer_list->peers.data, peer_list->peers.size);
38 else 38 else