summaryrefslogtreecommitdiff
path: root/trackerlogic.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-24 17:32:54 +0200
committerDirk Engling <erdgeist@erdgeist.org>2026-10-24 17:32:54 +0200
commita4904ed2e437275bfd92828ad09fbb677d7225d1 (patch)
tree53c29c6ab42b5b3091d6c1cb0fec2113c8fe0346 /trackerlogic.c
parentd61aefe2fc4d8549f459bdfc2749c9f163449ebc (diff)
free_peerlist now checks peer_list for NULL, so on alloc failure we don't dereference NULL
Diffstat (limited to 'trackerlogic.c')
-rw-r--r--trackerlogic.c4
1 files changed, 2 insertions, 2 deletions
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