Skip to content

Commit

Permalink
only free the the vp on the error path
Browse files Browse the repository at this point in the history
if the first byte is non-zero, then the result is non-zero,
and we don't need to check it on all paths
  • Loading branch information
alandekok committed Sep 8, 2023
1 parent c2080c5 commit f6b6d23
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/protocols/dhcpv4/packet.c
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,9 @@ int fr_dhcpv4_decode(TALLOC_CTX *ctx, fr_pair_list_t *out, uint8_t const *data,

q = memchr(p, '\0', dhcp_header_sizes[i]);
fr_pair_value_bstrndup(vp, (char const *)p, q ? q - p : dhcp_header_sizes[i], true);
} else {
TALLOC_FREE(vp);
}
if (vp->vp_length == 0) TALLOC_FREE(vp);
break;

/*
Expand Down

0 comments on commit f6b6d23

Please sign in to comment.