Skip to content

Commit

Permalink
modules/stats: be more correct on ENOMEM
Browse files Browse the repository at this point in the history
  • Loading branch information
vcunat committed Dec 20, 2024
1 parent efbb031 commit 4238b8c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/stats/stats.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,9 @@ int stats_init(struct kr_module *module)
/* Initialize ring buffer of recently visited upstreams */
array_init(data->upstreams.q);
if (array_reserve(data->upstreams.q, UPSTREAMS_COUNT) != 0) {
trie_free(data->trie);
lru_free(data->queries.frequent);
free(data);
return kr_error(ENOMEM);
}
data->upstreams.q.len = UPSTREAMS_COUNT; /* signify we use the entries */
Expand Down

0 comments on commit 4238b8c

Please sign in to comment.