Prevent a memory leak in digest.c
authorJuho Vähä-Herttua <juhovh@iki.fi>
Wed, 26 Feb 2014 07:07:00 +0000 (09:07 +0200)
committerJuho Vähä-Herttua <juhovh@iki.fi>
Wed, 26 Feb 2014 07:07:00 +0000 (09:07 +0200)
src/lib/digest.c

index 78c916ea51dd03e94575fb53db00abc7bc4e69ee..22912157c4c3c777b5d79c49f052384353f4f3bb 100644 (file)
@@ -141,9 +141,11 @@ digest_is_valid(const char *our_realm, const char *password,
        }
 
        if (!username || !realm || !nonce || !uri || !response) {
        }
 
        if (!username || !realm || !nonce || !uri || !response) {
+               free(auth);
                return 0;
        }
        if (strcmp(realm, our_realm) || strcmp(nonce, our_nonce) || strcmp(uri, our_uri)) {
                return 0;
        }
        if (strcmp(realm, our_realm) || strcmp(nonce, our_nonce) || strcmp(uri, our_uri)) {
+               free(auth);
                return 0;
        }
 
                return 0;
        }