]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Bug #1782: Memory leak in ncsa_auth on password changes
authorserassio <>
Mon, 2 Oct 2006 00:40:29 +0000 (00:40 +0000)
committerserassio <>
Mon, 2 Oct 2006 00:40:29 +0000 (00:40 +0000)
Forward port of a 2.6 patch.

helpers/basic_auth/NCSA/ncsa_auth.c

index 98bf691be342d5fd6d26baa27fec00229f67e8eb..07e5f7b045480e3bb72fb3ef4ebaad75734e30bf 100644 (file)
@@ -73,6 +73,7 @@ read_passwd_file(const char *passwdfile)
     char *passwd;
     if (hash != NULL) {
        hashFreeItems(hash, my_free);
+       hashFreeMemory(hash);
     }
     /* initial setup */
     hash = hash_create((HASHCMP *) strcmp, 7921, hash_string);
@@ -137,7 +138,7 @@ main(int argc, char **argv)
        }
        rfc1738_unescape(user);
        rfc1738_unescape(passwd);
-       u = (user_data *)hash_lookup(hash, user);
+       u = (user_data *) hash_lookup(hash, user);
        if (u == NULL) {
            printf("ERR No such user\n");
        } else if (strcmp(u->passwd, (char *) crypt(passwd, u->passwd)) == 0) {
@@ -148,5 +149,9 @@ main(int argc, char **argv)
            printf("ERR Wrong password\n");
        }
     }
+    if (hash != NULL) {
+       hashFreeItems(hash, my_free);
+       hashFreeMemory(hash);
+    }
     exit(0);
 }