From: Alan T. DeKok Date: Fri, 11 Sep 2015 16:09:39 +0000 (-0400) Subject: Revert "Copy VPs instead of talloc_stealing them" X-Git-Tag: release_3_0_10~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ae5ce2911614f2f5df58de208572d4598947d83b;p=thirdparty%2Ffreeradius-server.git Revert "Copy VPs instead of talloc_stealing them" This reverts commit a529c2d9bdef0f635fa10b2ab7e05527f95551b2. There's a better fix --- diff --git a/src/main/state.c b/src/main/state.c index ecc68ef9903..d52edf20416 100644 --- a/src/main/state.c +++ b/src/main/state.c @@ -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);