dsdb: Fix CID 1435968 Dereference before null check
authorVolker Lendecke <vl@samba.org>
Tue, 12 Jun 2018 19:31:15 +0000 (21:31 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 13 Jun 2018 11:40:55 +0000 (13:40 +0200)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Wed Jun 13 13:40:56 CEST 2018 on sn-devel-144

source4/dsdb/samdb/ldb_modules/partition.c

index 098fdb0916e20f466f6c98b516366e5f94c45371..49bdeb04fa51d1b20acfa7d5ac91faf648c51c27 100644 (file)
@@ -547,7 +547,6 @@ static int partition_copy_all_callback_handler(
        struct ldb_reply *ares)
 {
        struct partition_copy_context *ac = NULL;
-       int error = ares->error;
 
        ac = talloc_get_type(
                req->context,
@@ -574,8 +573,8 @@ static int partition_copy_all_callback_handler(
                        ac->request,
                        ares->referral);
 
-       case LDB_REPLY_DONE:
-               error = ares->error;
+       case LDB_REPLY_DONE: {
+               int error = ares->error;
                if (error == LDB_SUCCESS) {
                        error = partition_copy_all_callback_action(
                                ac->module,
@@ -588,6 +587,7 @@ static int partition_copy_all_callback_handler(
                        ares->controls,
                        ares->response,
                        error);
+       }
 
        default:
                /* Can't happen */