fix some UB

This commit is contained in:
Dale Weiler 2017-12-01 13:55:19 -05:00
parent 3cf2c52fce
commit 73d3d7eec1
2 changed files with 3 additions and 2 deletions

View file

@ -347,7 +347,7 @@ static bool parser_sy_apply_operator(parser_t *parser, shunt *sy)
const oper_info *op;
lex_ctx_t ctx;
ast_expression *out = nullptr;
ast_expression *exprs[3];
ast_expression *exprs[3] = { 0, 0, 0 };
ast_block *blocks[3];
ast_binstore *asbinstore;
size_t i, assignop, addop, subop;

View file

@ -28,11 +28,12 @@ char *stat_mem_strdup(const char *src, bool empty) {
* The reallocate function for resizing vectors.
*/
void _util_vec_grow(void **a, size_t i, size_t s) {
vector_t *d = vec_meta(*a);
vector_t *d = nullptr;
size_t m = 0;
void *p = nullptr;
if (*a) {
d = vec_meta(*a);
m = 2 * d->allocated + i;
p = mem_r(d, s * m + sizeof(vector_t));
} else {