diff options
author | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2007-12-05 14:31:19 +0000 |
---|---|---|
committer | joe <joe@61a7d7f5-40b7-0310-9c16-bb0ea8cb1845> | 2007-12-05 14:31:19 +0000 |
commit | 67ff79ecf2bd84db9af3a1eb136d1ec212bfbc70 (patch) | |
tree | 4aba7f41553e1df2c703fdb547a65fb85de835a3 /src/ne_auth.c | |
parent | 19cf8a4a273284be0b5ebe7ad0dcc37703b25668 (diff) | |
download | neon-67ff79ecf2bd84db9af3a1eb136d1ec212bfbc70.tar.gz |
* src/ne_auth.c (parse_domain): Fix memory handling (fix tests with
--enable-memleak).
git-svn-id: http://svn.webdav.org/repos/projects/neon/trunk@1287 61a7d7f5-40b7-0310-9c16-bb0ea8cb1845
Diffstat (limited to 'src/ne_auth.c')
-rw-r--r-- | src/ne_auth.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/ne_auth.c b/src/ne_auth.c index 1b3ee5b..f6180ec 100644 --- a/src/ne_auth.c +++ b/src/ne_auth.c @@ -633,9 +633,10 @@ static int sspi_challenge(auth_session *sess, int attempt, static int parse_domain(auth_session *sess, const char *domain) { char *cp = ne_strdup(domain), *p = cp; - ne_uri base = {0}; + ne_uri base; int invalid = 0; + memset(&base, 0, sizeof base); ne_fill_server_uri(sess->sess, &base); do { @@ -649,14 +650,14 @@ static int parse_domain(auth_session *sess, const char *domain) base.path = absolute.path; /* Ignore URIs not on this server. */ - if (ne_uri_cmp(&absolute, &base) == 0) { + if (absolute.path && ne_uri_cmp(&absolute, &base) == 0) { sess->domains = ne_realloc(sess->domains, ++sess->ndomains * sizeof(*sess->domains)); - sess->domains[sess->ndomains - 1] = ne_strdup(absolute.path); + sess->domains[sess->ndomains - 1] = absolute.path; + absolute.path = NULL; NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Using domain %s from %s\n", absolute.path, token); - absolute.path = NULL; } else { NE_DEBUG(NE_DBG_HTTPAUTH, "auth: Ignoring domain %s\n", @@ -678,6 +679,7 @@ static int parse_domain(auth_session *sess, const char *domain) } ne_free(cp); + base.path = NULL; ne_uri_free(&base); return invalid; |