s4-dsdb: Fix a possible NULL pointer dereference
authorAndreas Schneider <asn@samba.org>
Wed, 22 Jun 2016 13:48:10 +0000 (15:48 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 22 Jun 2016 17:25:20 +0000 (19:25 +0200)
Detected by clang compiler.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/dsdb/common/util_trusts.c

index 0e69ba20b733f75d631cda95fa51aa51ca2fa87c..a083d869f6eb83c9995e1427faa87259fba495a8 100644 (file)
@@ -2671,7 +2671,9 @@ NTSTATUS dsdb_trust_get_incoming_passwords(struct ldb_message *msg,
        if (_previous != NULL) {
                *_previous = talloc(mem_ctx, struct samr_Password);
                if (*_previous == NULL) {
-                       TALLOC_FREE(*_current);
+                       if (_current != NULL) {
+                               TALLOC_FREE(*_current);
+                       }
                        TALLOC_FREE(frame);
                        return NT_STATUS_NO_MEMORY;
                }