]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Use talloc to allocate tlvs in dhcp.c
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 20 Feb 2013 17:44:36 +0000 (12:44 -0500)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Wed, 6 Mar 2013 02:11:56 +0000 (21:11 -0500)
src/lib/dhcp.c

index e4bf140e94dbab7159723d764299ad4aa589c19c..f0ca90d860bada891107c098f25f3c259187abc4 100644 (file)
@@ -498,7 +498,7 @@ static int decode_tlv(VALUE_PAIR *tlv, const uint8_t *data, size_t data_len)
        return 0;
 
 make_tlv:
-       tlv->vp_tlv = malloc(data_len);
+       tlv->vp_tlv = talloc_array(tlv, uint8_t, data_len);
        if (!tlv->vp_tlv) {
                fr_strerror_printf("No memory");
                return -1;
@@ -988,7 +988,7 @@ static VALUE_PAIR *fr_dhcp_vp2suboption(VALUE_PAIR *vps)
                return NULL;
        }
 
-       tlv->vp_tlv = malloc(tlv->length);
+       tlv->vp_tlv = talloc_array(tlv, uint8_t, tlv->length);
        if (!tlv->vp_tlv) {
                pairfree(&tlv);
                return NULL;