* Decode the header fields.
*/
vp = fr_pair_afrom_da(ctx, attr_hop_count);
- if (!vp) return -1;
+ if (!vp) goto fail;
if (fr_value_box_from_network(vp, &vp->data, vp->da->type, NULL, packet + 1, 1, true) < 0) {
- return -1;
+ goto fail;
}
fr_cursor_append(cursor, vp);
vp = fr_pair_afrom_da(ctx, attr_relay_link_address);
- if (!vp) return -1;
+ if (!vp) goto fail;
if (fr_value_box_from_network(vp, &vp->data, vp->da->type, NULL, packet + 2, 16, true) < 0) {
- return -1;
+ goto fail;
}
fr_cursor_append(cursor, vp);
vp = fr_pair_afrom_da(ctx, attr_relay_peer_address);
- if (!vp) return -1;
+ if (!vp) goto fail;
if (fr_value_box_from_network(vp, &vp->data, vp->da->type, NULL, packet + 2 + 16, 16, true) < 0) {
- return -1;
+ goto fail;
}
+
fr_cursor_append(cursor, vp);
p = packet + 2 + 32;
* And the transaction ID.
*/
vp = fr_pair_afrom_da(ctx, attr_transaction_id);
- if (!vp) return -1;
+ if (!vp) {
+ fail:
+ fr_cursor_head(cursor);
+ fr_cursor_free_list(cursor);
+ return -1;
+ }
/*
* Copy 3 octets over.
while (p < end) {
slen = fr_dhcpv6_decode_option(ctx, cursor, dict_dhcpv6, p, (end - p), &packet_ctx);
if (slen < 0) {
+ fr_cursor_head(cursor);
+ fr_cursor_free_list(cursor);
talloc_free(packet_ctx.tmp_ctx);
return slen;
}
* all kinds of bad things happen.
*/
if (!fr_cond_assert(slen <= (end - p))) {
+ fr_cursor_head(cursor);
+ fr_cursor_free_list(cursor);
talloc_free(packet_ctx.tmp_ctx);
return -1;
}