]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
delay allocation of tmp_ctx until we need it
authorAlan T. DeKok <aland@freeradius.org>
Tue, 29 Oct 2019 18:34:19 +0000 (14:34 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Tue, 29 Oct 2019 18:35:42 +0000 (14:35 -0400)
src/protocols/dhcpv6/base.c

index 283481e87bb68bddd77d04242855004a9a3e14de..1bfaa1e6429cefb9170456fdb55ae5eb37ce9806 100644 (file)
@@ -361,8 +361,6 @@ ssize_t     fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
        fr_dhcpv6_decode_ctx_t  packet_ctx;
        VALUE_PAIR              *vp;
 
-       packet_ctx.tmp_ctx = talloc_init("tmp");
-
        fr_cursor_init(&cursor, vps);
 
        /*
@@ -407,6 +405,8 @@ ssize_t     fr_dhcpv6_decode(TALLOC_CTX *ctx, uint8_t const *packet, size_t packet_l
        p = packet + 4;
        end = packet + packet_len;
 
+       packet_ctx.tmp_ctx = talloc_init("tmp");
+
        /*
         *      The caller MUST have called fr_dhcpv6_ok() first.  If
         *      he doesn't, all hell breaks loose.