From: Dale Weiler Date: Fri, 1 Dec 2017 18:55:19 +0000 (-0500) Subject: fix some UB X-Git-Tag: xonotic-v0.8.5~27 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=73d3d7eec1f9bbdf0f5905bf25d5d1f05aaf1995;p=xonotic%2Fgmqcc.git fix some UB --- diff --git a/parser.cpp b/parser.cpp index 7e55232..9bfd751 100644 --- a/parser.cpp +++ b/parser.cpp @@ -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; diff --git a/stat.cpp b/stat.cpp index 1797536..5f85a1a 100644 --- a/stat.cpp +++ b/stat.cpp @@ -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 {