summaryrefslogtreecommitdiff
path: root/src/htscore.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/htscore.c')
-rw-r--r--src/htscore.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/htscore.c b/src/htscore.c
index d2d396d..e0fdcc9 100644
--- a/src/htscore.c
+++ b/src/htscore.c
@@ -263,6 +263,11 @@ static size_t hts_record_link_alloc(httrackp *opt) {
assertf(opt != NULL);
assertf(liensbuf != NULL);
+ // Limit the number of links
+ if (opt->maxlink > 0 && TypedArraySize(liensbuf->ptr) >= opt->maxlink) {
+ return (size_t) -1;
+ }
+
// Create a new chunk of lien_url[]
// There are references to item pointers, so we can not just realloc()
if (liensbuf->lien_buffer_size == liensbuf->lien_buffer_capa) {