diff options
author | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-29 17:29:02 +0000 |
---|---|---|
committer | Xavier Roche <xroche@users.noreply.github.com> | 2014-05-29 17:29:02 +0000 |
commit | 8dd39bc909a7c9fdca1009f1e375de756149e4d7 (patch) | |
tree | ea4062c66ae0b5e9a23ed85ab8aa8458c59b5b98 /src/htscore.c | |
parent | 17ec3ecd6b8d4d5f19f5d50ce34b8bfa2894c3be (diff) |
Take in account opt->maxlink is non-zero
Diffstat (limited to 'src/htscore.c')
-rw-r--r-- | src/htscore.c | 5 |
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) { |