From: Alan T. DeKok Date: Tue, 16 Jun 2015 14:23:28 +0000 (-0400) Subject: Don't copy the VPs when we can just move them X-Git-Tag: release_3_0_9~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2362816ccc9dcf594e9f1300ccf868d8a20b2a99;p=thirdparty%2Ffreeradius-server.git Don't copy the VPs when we can just move them --- diff --git a/src/main/tls.c b/src/main/tls.c index 1936bf56ac8..260b7e45445 100644 --- a/src/main/tls.c +++ b/src/main/tls.c @@ -1257,12 +1257,12 @@ static SSL_SESSION *cbtls_get_session(SSL *ssl, unsigned char *data, int len, in char filename[256]; unsigned char *p; struct stat st; - VALUE_PAIR *vp; + VALUE_PAIR *vps = NULL; /* read in the cached VPs from the .vps file */ snprintf(filename, sizeof(filename), "%s%c%s.vps", conf->session_cache_path, FR_DIR_SEP, buffer); - rv = pairlist_read(NULL, filename, &pairlist, 1); + rv = pairlist_read(talloc_ctx, filename, &pairlist, 1); if (rv < 0) { /* not safe to un-persist a session w/o VPs */ RWDEBUG("Failed loading persisted VPs for session %s", buffer); @@ -1314,9 +1314,9 @@ static SSL_SESSION *cbtls_get_session(SSL *ssl, unsigned char *data, int len, in goto err; } - /* cache the VPs into the session */ - vp = paircopy(talloc_ctx, pairlist->reply); - SSL_SESSION_set_ex_data(sess, fr_tls_ex_index_vps, vp); + /* move the cached VPs into the session */ + pairfilter(talloc_ctx, &vps, &pairlist->reply, 0, 0, TAG_ANY); + SSL_SESSION_set_ex_data(sess, fr_tls_ex_index_vps, vps); RWDEBUG("Successfully restored session %s", buffer); } err: