Skip to content

Commit a42da3b

Browse files
committed
Fixed minor check-after-dereference
1 parent 9a92d06 commit a42da3b

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/image.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,13 @@ static int image_hash(struct wolfBoot_image *img, uint8_t *hash)
149149
{
150150
uint8_t *stored_sha, *end_sha;
151151
uint8_t stored_sha_len;
152-
uint8_t *p = get_img_hdr(img);
152+
uint8_t *p;
153153
int blksz;
154154
uint32_t position = 0;
155155
wc_Sha256 sha256_ctx;
156156
if (!img)
157157
return -1;
158+
p = get_img_hdr(img);
158159
stored_sha_len = get_header(img, HDR_SHA256, &stored_sha);
159160
if (stored_sha_len != SHA256_DIGEST_SIZE)
160161
return -1;

0 commit comments

Comments
 (0)