Skip to content

Commit a4fef71

Browse files
committed
Document TryCalloc compatibility
1 parent 17e5571 commit a4fef71

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/data-structure.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,8 @@ uint32_t* bitmap_range_int_array(const Bitmap* bitmap, size_t start_offset, size
821821
return NULL;
822822
}
823823

824+
// Avoid rm_calloc_try here: RedisModule_TryCalloc is missing on Redis 6.2/7.0 and crashes
825+
// when invoked; see https://github.com/aviggiano/redis-roaring/issues/139#issuecomment-3776839439
824826
uint32_t* ans = rm_calloc(range_size, sizeof(uint32_t));
825827
if (ans == NULL) {
826828
return NULL;
@@ -859,6 +861,8 @@ uint64_t* bitmap64_range_int_array(const Bitmap64* bitmap, uint64_t start_offset
859861
return NULL;
860862
}
861863

864+
// Avoid rm_calloc_try here: RedisModule_TryCalloc is missing on Redis 6.2/7.0 and crashes
865+
// when invoked; see https://github.com/aviggiano/redis-roaring/issues/139#issuecomment-3776839439
862866
uint64_t* ans = rm_calloc(range_size, sizeof(uint64_t));
863867

864868
if (ans == NULL) {

0 commit comments

Comments
 (0)