libdrgn: language_c: add missing error check in c_parse_abstract_declarator()

Found with clang-static-analyzer.

Reported-by: Kevin Svetlitski <svetlitski@fb.com>
Signed-off-by: Omar Sandoval <osandov@osandov.com>
This commit is contained in:
Omar Sandoval 2021-12-08 13:47:12 -08:00
parent f09fd13ef6
commit 8a41adc1b0

View File

@ -2445,6 +2445,8 @@ c_parse_abstract_declarator(struct drgn_program *prog,
return err; return err;
err = drgn_lexer_peek(lexer, &token); err = drgn_lexer_peek(lexer, &token);
if (err)
return err;
if (token.kind == C_TOKEN_LPAREN || if (token.kind == C_TOKEN_LPAREN ||
token.kind == C_TOKEN_LBRACKET) { token.kind == C_TOKEN_LBRACKET) {
struct c_declarator *tmp; struct c_declarator *tmp;