ctx->roots = p_new(ctx->parser_pool, struct setting_link, count);
for (i = 0; i < count; i++) {
ctx->roots[i].info = roots[i];
+ if (roots[i]->struct_size == 0)
+ continue;
+
ctx->roots[i].set_struct =
p_malloc(ctx->set_pool, roots[i]->struct_size);
if ((flags & SETTINGS_PARSER_FLAG_TRACK_CHANGES) != 0) {
void *dest_set, *dest, *const *children;
unsigned int i, count;
+ if (info->struct_size == 0)
+ return NULL;
+
/* don't just copy everything from set to dest_set. it may contain
some non-setting fields allocated from the original pool. */
dest_set = p_malloc(pool, info->struct_size);
void *dest_set, *dest, *const *children;
unsigned int i, count;
- if (change_set == NULL)
+ if (change_set == NULL || info->struct_size == 0)
return NULL;
dest_set = p_malloc(pool, info->struct_size);
void *dest_set, *set, *const *children;
unsigned int i, count;
+ if (info->struct_size == 0)
+ return NULL;
+
dest_set = p_malloc(pool, info->struct_size);
for (def = info->defines; def->key != NULL; def++) {
if (def->type != SET_DEFLIST)