dsdb/replmd: use ldb_msg_remove_element()
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 10 Apr 2019 04:40:34 +0000 (16:40 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 10 May 2019 01:15:18 +0000 (01:15 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index d4ae1860fd18123e45b38d42162b7417e4b5bd90..e68a376a79e9bc83f2afcc3331fffba29a02b57e 100644 (file)
@@ -5491,8 +5491,7 @@ static int replmd_replicated_apply_add(struct replmd_replicated_request *ar)
 
                        DEBUG(4,(__location__ ": Removing attribute %s with num_values==0\n",
                                 el->name));
-                       memmove(el, el+1, sizeof(*el)*(msg->num_elements - (i+1)));
-                       msg->num_elements--;
+                       ldb_msg_remove_element(msg, &msg->elements[i]);
                        i--;
                        continue;
                }