Skip to content

Commit

Permalink
Move coverity-only check ahead of first use (CID #1635782)
Browse files Browse the repository at this point in the history
The check that dctx->dict is non-NULL has to appear before
the first dereference of dctx->dict.
  • Loading branch information
jejones3141 committed Dec 4, 2024
1 parent 9a66cc1 commit 5790fee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/util/dict_tokenize.c
Original file line number Diff line number Diff line change
Expand Up @@ -1916,6 +1916,10 @@ static int dict_read_process_enum(dict_tokenize_ctx_t *dctx, char **argv, int ar
return -1;
}

#ifdef STATIC_ANALYZER
if (!dctx->dict) goto error;
#endif

/*
* Allocate the attribute here, and then fill in the fields
* as we start parsing the various elements of the definition.
Expand Down Expand Up @@ -1971,10 +1975,6 @@ static int dict_read_process_enum(dict_tokenize_ctx_t *dctx, char **argv, int ar
* Maybe we do want a flag field for named time deltas?
*/

#ifdef STATIC_ANALYZER
if (!dctx->dict) goto error;
#endif

if (unlikely(dict_attr_parent_init(&da, parent) < 0)) goto error;
if (unlikely(dict_attr_finalise(&da, argv[0]) < 0)) goto error;

Expand Down

0 comments on commit 5790fee

Please sign in to comment.