We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 8aa66d0 + 1c32252 commit a1e7c89Copy full SHA for a1e7c89
src/util/pm_constant_pool.c
@@ -15,8 +15,12 @@ pm_constant_id_list_init(pm_constant_id_list_t *list) {
15
*/
16
void
17
pm_constant_id_list_init_capacity(pm_constant_id_list_t *list, size_t capacity) {
18
- list->ids = xcalloc(capacity, sizeof(pm_constant_id_t));
19
- if (list->ids == NULL) abort();
+ if (capacity) {
+ list->ids = xcalloc(capacity, sizeof(pm_constant_id_t));
20
+ if (list->ids == NULL) abort();
21
+ } else {
22
+ list->ids = NULL;
23
+ }
24
25
list->size = 0;
26
list->capacity = capacity;
0 commit comments