s3-spnego: fix memleak in spnego_parse_auth().
authorGünther Deschner <gd@samba.org>
Thu, 15 Oct 2009 13:45:20 +0000 (15:45 +0200)
committerGünther Deschner <gd@samba.org>
Thu, 15 Oct 2009 13:45:20 +0000 (15:45 +0200)
Guenther

source3/libsmb/clispnego.c

index 1103ef84b63bf965936929b5728eb50bd23ec9b6..e20749b3e8af57e4263409f67120d20b68bd6197 100644 (file)
@@ -507,10 +507,14 @@ bool spnego_parse_auth(DATA_BLOB blob, DATA_BLOB *auth)
        if (token.type != SPNEGO_NEG_TOKEN_TARG) {
                DEBUG(3,("spnego_parse_auth: wrong token type: %d\n",
                        token.type));
        if (token.type != SPNEGO_NEG_TOKEN_TARG) {
                DEBUG(3,("spnego_parse_auth: wrong token type: %d\n",
                        token.type));
+               spnego_free_data(&token);
                return false;
        }
 
                return false;
        }
 
-       *auth = token.negTokenTarg.responseToken;
+       *auth = data_blob_talloc(talloc_tos(),
+                                token.negTokenTarg.responseToken.data,
+                                token.negTokenTarg.responseToken.length);
+       spnego_free_data(&token);
 
        return true;
 }
 
        return true;
 }