summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2022-04-22 11:33:41 +0200
committerCarlos Garcia Campos <cgarcia@igalia.com>2022-04-22 14:21:12 +0200
commit297a50ae19152dc78e6e1f82625cda7f120fe64e (patch)
tree5642b1aca3024d65d2931139dc69e3221ef12b50
parentf762884d81c1290a9d18883910806685cc2983cd (diff)
downloadlibsoup-297a50ae19152dc78e6e1f82625cda7f120fe64e.tar.gz
soup-auth-ntlm: Fix a memory leak
The soup_ntlm_parse_challenge() can be called multiple times, but it doesn't free any previously stored value, thus causes a memory leak.
-rw-r--r--libsoup/auth/soup-auth-ntlm.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libsoup/auth/soup-auth-ntlm.c b/libsoup/auth/soup-auth-ntlm.c
index 457cc98b..8fdadf14 100644
--- a/libsoup/auth/soup-auth-ntlm.c
+++ b/libsoup/auth/soup-auth-ntlm.c
@@ -758,12 +758,14 @@ soup_ntlm_parse_challenge (const char *challenge,
return FALSE;
}
+ g_free (*default_domain);
*default_domain = g_convert ((char *)chall + domain.offset,
domain.length, "UTF-8", "UCS-2LE",
NULL, NULL, NULL);
}
if (nonce) {
+ g_free (*nonce);
*nonce = g_memdup2 (chall + NTLM_CHALLENGE_NONCE_OFFSET,
NTLM_CHALLENGE_NONCE_LENGTH);
}
@@ -777,6 +779,7 @@ soup_ntlm_parse_challenge (const char *challenge,
g_free (chall);
return FALSE;
}
+ g_free (*target_info);
*target_info = g_memdup2 (chall + target.offset, target.length);
*target_info_sz = target.length;
}