initialise runtime data, which avoids using bad pointers in tls.c as in issue 273

This commit is contained in:
yrutschle 2020-07-29 22:52:48 +02:00
parent 08ce89b6e2
commit 0af37a1bed
2 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
* on Wed Jul 29 22:30:25 2020.
* on Wed Jul 29 22:51:16 2020.
# conf2struct: generate libconf parsers that read to structs
# Copyright (C) 2018-2019 Yves Rutschle
@ -1164,7 +1164,7 @@ static void read_block_init(void* target, config_setting_t* cfg, struct config_d
if (setting)
len = config_setting_length(setting);
}
block = malloc(desc->size * len);
block = calloc(len, desc->size);
*(size_t*)(((char*)target) + desc->offset_len) = len;
*(void**)(((char*)target) + desc->offset) = block;
@ -1172,7 +1172,7 @@ static void read_block_init(void* target, config_setting_t* cfg, struct config_d
break;
case CFG_GROUP:
block = malloc(desc->size);
block = calloc(1, desc->size);
*(void**)(((char*)target) + desc->offset) = block;
TRACE_READ((" sizing for %zu elems ", len));
break;

View File

@ -1,5 +1,5 @@
/* Generated by conf2struct (https://www.rutschle.net/tech/conf2struct/README)
* on Wed Jul 29 22:30:25 2020.
* on Wed Jul 29 22:51:16 2020.
# conf2struct: generate libconf parsers that read to structs
# Copyright (C) 2018-2019 Yves Rutschle