Author: mkhl
Date: 2006-07-15 09:01:20 +0000 (Sat, 15 Jul 2006)
New Revision: 17050

WebSVN: 
http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=17050

Log:
Copy (don't steal) the old msg element when adding to the local
message.  The old elements are accessed from an array and usually
haven't been tallocced themselves.

Martin

Modified:
   branches/SOC/mkhl/ldb-map/modules/ldb_map.c


Changeset:
Modified: branches/SOC/mkhl/ldb-map/modules/ldb_map.c
===================================================================
--- branches/SOC/mkhl/ldb-map/modules/ldb_map.c 2006-07-15 08:56:19 UTC (rev 
17049)
+++ branches/SOC/mkhl/ldb-map/modules/ldb_map.c 2006-07-15 09:01:20 UTC (rev 
17050)
@@ -1586,9 +1586,17 @@
        return ldb_msg_add(remote, el, old->flags);
 
 local:
-       /* TODO: do we need a copy or can we just steal it? */
-       return ldb_msg_add(local, talloc_steal(local, old), old->flags);
+       /* copy the message element */
+       el = talloc(local, struct ldb_message_element);
+       if (el == NULL) {
+               ldb_oom(module->ldb);
+               goto failed;
+       }
 
+       *el = *old;             /* copy the old element */
+
+       return ldb_msg_add(local, el, old->flags);
+
 failed:
        return -1;
 }

Reply via email to