auth/credentials: Avoid double-free in the failure case
authorAndrew Bartlett <abartlet@samba.org>
Tue, 28 Aug 2012 23:09:10 +0000 (09:09 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Tue, 28 Aug 2012 23:09:10 +0000 (09:09 +1000)
This pointer is only valid if dbwrap_fetch returned success.

Andrew Bartlett

auth/credentials/credentials_secrets.c

index 33042006075cd59013423f856c6d0ee7b0ccbf0d..37e825bee90194c3eb11832b51547baf8fd035cc 100644 (file)
@@ -235,8 +235,8 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr
                TALLOC_FREE(keystr_upper);
                if (NT_STATUS_IS_OK(status) && dbuf.dsize == 4) {
                        secrets_tdb_lct = IVAL(dbuf.dptr,0);
+                       TALLOC_FREE(dbuf.dptr);
                }
-               TALLOC_FREE(dbuf.dptr);
 
                keystr = talloc_asprintf(cred, "%s/%s",
                                         SECRETS_MACHINE_PASSWORD,