Clang found an uninitialized pointer.

This commit is contained in:
Olaf Seibert
2021-01-23 22:06:12 +01:00
parent c53aec71c3
commit 706e4e9758
2 changed files with 5 additions and 2 deletions

View File

@@ -718,7 +718,7 @@ EX_TREE *evaluate(
EX_TREE *new_ex_tree( EX_TREE *new_ex_tree(
void) void)
{ {
EX_TREE *tr = memcheck(malloc(sizeof(EX_TREE))); EX_TREE *tr = memcheck(calloc(1, sizeof(EX_TREE)));
return tr; return tr;
} }

View File

@@ -951,7 +951,7 @@ EX_TREE *parse_unary(
char bound = tolower((unsigned char)cp[2]); char bound = tolower((unsigned char)cp[2]);
char *cp2 = skipwhite(cp + 3); char *cp2 = skipwhite(cp + 3);
int islocal = 0; int islocal = 0;
char *endcp; char *endcp = NULL;
char *psectname = get_symbol(cp2, &endcp, &islocal); char *psectname = get_symbol(cp2, &endcp, &islocal);
SYMBOL *sectsym = psectname ? lookup_sym(psectname, &section_st) : NULL; SYMBOL *sectsym = psectname ? lookup_sym(psectname, &section_st) : NULL;
@@ -974,6 +974,9 @@ EX_TREE *parse_unary(
} }
} else { } else {
/* report(stack->top, "psect name %s not found\n", psectname); */ /* report(stack->top, "psect name %s not found\n", psectname); */
if (!endcp) {
endcp = cp;
}
if (pass == 0) { if (pass == 0) {
/* /*
* During the first pass it is expected that the psect is not * During the first pass it is expected that the psect is not