Skip to content

Commit

Permalink
core: fix potential NULL ptr dereference
Browse files Browse the repository at this point in the history
found via gcc-10 -fanalyze static analyzer

Signed-off-by: Markus Klotzbuecher <mk@mkio.de>
  • Loading branch information
kmarkus committed May 19, 2020
1 parent abbc386 commit 853bd61
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions libubx/ubx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1124,8 +1124,9 @@ static ubx_block_t *ubx_block_clone(ubx_block_t *prot, const char *name)
ubx_config_t *srcconf, *tgtconf;

newb = calloc(1, sizeof(ubx_block_t));

if (newb == NULL)
goto out_free;
goto out;

newb->block_state = BLOCK_STATE_PREINIT;

Expand Down Expand Up @@ -1209,8 +1210,9 @@ static ubx_block_t *ubx_block_clone(ubx_block_t *prot, const char *name)
/* all ok */
return newb;

out_free:
out_free:
ubx_block_free(newb);
out:
return NULL;
}

Expand Down

0 comments on commit 853bd61

Please sign in to comment.