ldb: Use ARRAY_DEL_ELEMENT() in ldb_dn_set_extended_component()
authorVolker Lendecke <vl@samba.org>
Thu, 26 Mar 2020 10:12:55 +0000 (11:12 +0100)
committerRalph Boehme <slow@samba.org>
Thu, 26 Mar 2020 14:43:32 +0000 (14:43 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
lib/ldb/common/ldb_dn.c

index 54c845c38ba459c9e88fc0e83125cc853305e84d..001fcad621f058f5e1ae22317929f94d43447451 100644 (file)
@@ -2062,12 +2062,10 @@ int ldb_dn_set_extended_component(struct ldb_dn *dn,
                                        return LDB_ERR_OPERATIONS_ERROR;
                                }
                        } else {
-                               if (i != (dn->ext_comp_num - 1)) {
-                                       memmove(&dn->ext_components[i],
-                                               &dn->ext_components[i+1],
-                                               ((dn->ext_comp_num-1) - i) *
-                                                 sizeof(*dn->ext_components));
-                               }
+                               ARRAY_DEL_ELEMENT(
+                                       dn->ext_components,
+                                       i,
+                                       dn->ext_comp_num);
                                dn->ext_comp_num--;
 
                                dn->ext_components = talloc_realloc(dn,