From 61dc9aad9b9415fb4ea41d78ab56d9fce449cfdb Mon Sep 17 00:00:00 2001 From: David Korczynski Date: Mon, 28 Aug 2023 03:22:01 -0700 Subject: [PATCH] config_format: yaml: fix null dereference Signed-off-by: David Korczynski --- src/config_format/flb_cf_yaml.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/config_format/flb_cf_yaml.c b/src/config_format/flb_cf_yaml.c index 4ef77a578a1..5fc42bdcb1d 100644 --- a/src/config_format/flb_cf_yaml.c +++ b/src/config_format/flb_cf_yaml.c @@ -1285,13 +1285,13 @@ static int consume_event(struct flb_cf *conf, struct local_ctx *ctx, break; case YAML_SEQUENCE_START_EVENT: /* start a new group */ - if (strcmp(state->key, "processors") == 0) { - yaml_error_event(ctx, state, event); + if (state->key == NULL) { + flb_error("no key"); return YAML_FAILURE; } - if (state->key == NULL) { - flb_error("no key"); + if (strcmp(state->key, "processors") == 0) { + yaml_error_event(ctx, state, event); return YAML_FAILURE; }