From 3c6792bc76323f821bc9e44ea3d724ce39e9081f Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Sat, 13 Mar 2010 18:39:54 +0100 Subject: s4:registry - ldb.c - Move the "val" structure Move it into the REG_SZ/REG_EXPAND_SZ case block since it's used only there. Plus convert it from static into dynamic talloc'ed. --- source4/lib/registry/ldb.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'source4/lib') diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 0213c54a53..f226cbf450 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -98,7 +98,6 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, const char *name, uint32_t type, DATA_BLOB data) { - struct ldb_val val; struct ldb_message *msg = talloc_zero(mem_ctx, struct ldb_message); char *type_s; @@ -109,11 +108,14 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, case REG_EXPAND_SZ: if ((data.length > 0) && (data.data != NULL) && (data.data[0] != '\0')) { + struct ldb_val *val; + + val = talloc_zero(msg, struct ldb_val); convert_string_talloc(mem_ctx, CH_UTF16, CH_UTF8, (void *)data.data, data.length, - (void **)&val.data, &val.length, false); - ldb_msg_add_value(msg, "data", &val, NULL); + (void **)&val->data, &val->length, false); + ldb_msg_add_value(msg, "data", val, NULL); } else { ldb_msg_add_empty(msg, "data", LDB_FLAG_MOD_DELETE, NULL); } -- cgit