s3:winbindd: Do not free db_path in idmap_tdb2 before we printed it
authorAndreas Schneider <asn@samba.org>
Wed, 8 May 2019 15:05:58 +0000 (17:05 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 8 May 2019 16:33:24 +0000 (16:33 +0000)
Found by GCC 9.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/winbindd/idmap_tdb2.c

index 3ae309e5e5b3525cced5d445c832a70177a0d142..b784546bb330a05fded8e728e1a01eea01a03a67 100644 (file)
@@ -115,13 +115,13 @@ static NTSTATUS idmap_tdb2_open_db(struct idmap_domain *dom)
        /* Open idmap repository */
        ctx->db = db_open(ctx, db_path, 0, TDB_DEFAULT, O_RDWR|O_CREAT, 0644,
                          DBWRAP_LOCK_ORDER_1, DBWRAP_FLAG_NONE);
-       TALLOC_FREE(db_path);
-
        if (ctx->db == NULL) {
                DEBUG(0, ("Unable to open idmap_tdb2 database '%s'\n",
                          db_path));
+               TALLOC_FREE(db_path);
                return NT_STATUS_UNSUCCESSFUL;
        }
+       TALLOC_FREE(db_path);
 
        return idmap_tdb2_init_hwm(dom);
 }