[vlc-devel] [PATCH] Stop realm variable in modules/access/http.c from being freed too early.

Aaron Wyatt github at psi-borg.org
Fri May 8 02:45:42 CEST 2020


I hate replying to my own messages, but now that I think about it, 
there's an even easier fix for this which I can't believe I didn't spot 
earlier. (Thanks, shower thoughts.) Simply point credential.psz_realm to 
p_sys->auth.psz_realm regardless of whether there's a 401 error or not. 
Then you don't need to worry about saving the previous copy of it. 
(Either way, both solutions fix the issue.) So:

---
  modules/access/http.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/access/http.c b/modules/access/http.c
index 4384e2b0a3..b4645c0f4e 100644
--- a/modules/access/http.c
+++ b/modules/access/http.c
@@ -275,6 +275,8 @@ connect:
      if( Connect( p_access ) )
          goto disconnect;

+    credential.psz_realm = p_sys->auth.psz_realm;
+
      if( p_sys->i_code == 401 )
      {
          if( p_sys->auth.psz_realm == NULL )
@@ -296,7 +298,6 @@ connect:
          msg_Dbg( p_access, "authentication failed for realm %s",
                   p_sys->auth.psz_realm );

-        credential.psz_realm = p_sys->auth.psz_realm;
          credential.psz_authtype = p_sys->auth.psz_nonce  ? "Digest" : 
"Basic";

          if( vlc_credential_get( &credential, p_access, NULL, NULL,



More information about the vlc-devel mailing list