]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Revert "Copy VPs instead of talloc_stealing them"
authorAlan T. DeKok <aland@freeradius.org>
Fri, 11 Sep 2015 16:09:39 +0000 (12:09 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Fri, 11 Sep 2015 16:09:39 +0000 (12:09 -0400)
This reverts commit a529c2d9bdef0f635fa10b2ab7e05527f95551b2.

There's a better fix

src/main/state.c

index ecc68ef9903091e32f18f10e8765bad700701ade..d52edf2041659c65d07a2e17897f2a5a17a90b2f 100644 (file)
@@ -397,18 +397,9 @@ void fr_state_get_vps(REQUEST *request, RADIUS_PACKET *packet)
        /*
         *      This has to be done in a mutex lock, because talloc
         *      isn't thread-safe.
-        *
-        *      We also COPY the VPs instead of moving them.  This is
-        *      because moving does a talloc_steal(), which keeps the
-        *      parent context around.
         */
        if (entry) {
-               VALUE_PAIR *vps;
-
-               vps = fr_pair_list_copy_by_num(request, entry->vps, 0, 0, TAG_ANY);
-               fr_pair_list_move(request, &request->state, &vps);
-               fr_pair_list_free(&entry->vps);
-
+               fr_pair_list_move_by_num(request, &request->state, &entry->vps, 0, 0, TAG_ANY);
                RDEBUG2("session-state: Found cached attributes");
                rdebug_pair_list(L_DBG_LVL_1, request, request->state, NULL);
 
@@ -458,13 +449,8 @@ bool fr_state_put_vps(REQUEST *request, RADIUS_PACKET *original, RADIUS_PACKET *
        /*
         *      This has to be done in a mutex lock, because talloc
         *      isn't thread-safe.
-        *
-        *      We also COPY the VPs instead of moving them.  This is
-        *      because moving does a talloc_steal(), which keeps the
-        *      parent context around.
         */
-       entry->vps = fr_pair_list_copy_by_num(request, request->state, 0, 0, TAG_ANY);
-       fr_pair_list_free(&request->state);
+       fr_pair_list_move_by_num(entry, &entry->vps, &request->state, 0, 0, TAG_ANY);
        PTHREAD_MUTEX_UNLOCK(&state->mutex);
 
        rad_assert(request->state == NULL);