s4:dsdb/common/util.c - samdb_msg_add_string - the attribute name doesn't need to...
authorMatthias Dieter Wallnöfer <mdw@samba.org>
Thu, 14 Oct 2010 20:41:06 +0000 (22:41 +0200)
committerMatthias Dieter Wallnöfer <mdw@samba.org>
Fri, 15 Oct 2010 06:45:01 +0000 (08:45 +0200)
This is done internally by the LDB library - look at "ldb_msg_add_empty".

source4/dsdb/common/util.c

index 18a8669f29bffd46827931edca5b4e30d3d04944..3dd5f78964f378d6b418a536c1d369aaf0453858 100644 (file)
@@ -770,12 +770,11 @@ int samdb_find_or_add_attribute(struct ldb_context *ldb, struct ldb_message *msg
 int samdb_msg_add_string(struct ldb_context *sam_ldb, TALLOC_CTX *mem_ctx, struct ldb_message *msg,
                         const char *attr_name, const char *str)
 {
-       char *s = talloc_strdup(mem_ctx, str);
-       char *a = talloc_strdup(mem_ctx, attr_name);
-       if (s == NULL || a == NULL) {
+       const char *s = talloc_strdup(mem_ctx, str);
+       if (s == NULL) {
                return ldb_oom(sam_ldb);
        }
-       return ldb_msg_add_string(msg, a, s);
+       return ldb_msg_add_string(msg, attr_name, s);
 }
 
 /*