summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-22 20:10:26 +0100
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-03-22 22:31:05 +0100
commitdc17292f1a097d3abd8c391315b661034ab1914e (patch)
tree06d2d052cc955005c3387095adbef42db819e293 /source4
parent9c3e6249fd984b823a77cab0514601d2a487920a (diff)
downloadsamba-dc17292f1a097d3abd8c391315b661034ab1914e.tar.gz
samba-dc17292f1a097d3abd8c391315b661034ab1914e.tar.bz2
samba-dc17292f1a097d3abd8c391315b661034ab1914e.zip
s4:registry - add more "W_ERROR_HAVE_NO_MEMORY" invocations (on talloc'ed stuff)
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/registry/patchfile_dotreg.c3
-rw-r--r--source4/lib/registry/regf.c7
-rw-r--r--source4/lib/registry/rpc.c3
-rw-r--r--source4/lib/registry/samba.c1
4 files changed, 13 insertions, 1 deletions
diff --git a/source4/lib/registry/patchfile_dotreg.c b/source4/lib/registry/patchfile_dotreg.c
index 12f2f70774..5bb955ebc3 100644
--- a/source4/lib/registry/patchfile_dotreg.c
+++ b/source4/lib/registry/patchfile_dotreg.c
@@ -181,9 +181,11 @@ _PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
/* Deleting key */
if (line[1] == '-') {
curkey = talloc_strndup(line, line+2, strlen(line)-3);
+ W_ERROR_HAVE_NO_MEMORY(curkey);
error = callbacks->del_key(callback_data,
curkey);
+
if (!W_ERROR_IS_OK(error)) {
DEBUG(0,("Error deleting key %s\n",
curkey));
@@ -196,6 +198,7 @@ _PUBLIC_ WERROR reg_dotreg_diff_load(int fd,
continue;
}
curkey = talloc_strndup(mem_ctx, line+1, strlen(line)-2);
+ W_ERROR_HAVE_NO_MEMORY(curkey);
error = callbacks->add_key(callback_data, curkey);
if (!W_ERROR_IS_OK(error)) {
diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c
index 52adb3ae98..5825ac18a8 100644
--- a/source4/lib/registry/regf.c
+++ b/source4/lib/registry/regf.c
@@ -455,6 +455,7 @@ static WERROR regf_get_info(TALLOC_CTX *mem_ctx,
*classname = talloc_strndup(mem_ctx,
(char*)data.data,
private_data->nk->clsname_length);
+ W_ERROR_HAVE_NO_MEMORY(*classname);
} else
*classname = NULL;
}
@@ -540,8 +541,10 @@ static WERROR regf_get_value(TALLOC_CTX *ctx, struct hive_key *key,
}
/* FIXME: name character set ?*/
- if (name != NULL)
+ if (name != NULL) {
*name = talloc_strndup(ctx, vk->data_name, vk->name_length);
+ W_ERROR_HAVE_NO_MEMORY(*name);
+ }
if (data_type != NULL)
*data_type = vk->data_type;
@@ -549,6 +552,7 @@ static WERROR regf_get_value(TALLOC_CTX *ctx, struct hive_key *key,
if (vk->data_length & 0x80000000) {
vk->data_length &=~0x80000000;
data->data = (uint8_t *)talloc_memdup(ctx, (uint8_t *)&vk->data_offset, vk->data_length);
+ W_ERROR_HAVE_NO_MEMORY(data->data);
data->length = vk->data_length;
} else {
*data = hbin_get(regf, vk->data_offset);
@@ -773,6 +777,7 @@ static WERROR regf_get_subkey_by_index(TALLOC_CTX *ctx,
*classname = talloc_strndup(ctx,
(char*)db.data,
ret->nk->clsname_length);
+ W_ERROR_HAVE_NO_MEMORY(*classname);
} else
*classname = NULL;
}
diff --git a/source4/lib/registry/rpc.c b/source4/lib/registry/rpc.c
index d7b853bb92..a596fad2e3 100644
--- a/source4/lib/registry/rpc.c
+++ b/source4/lib/registry/rpc.c
@@ -117,6 +117,7 @@ static WERROR rpc_get_predefined_key(struct registry_context *ctx,
}
mykeydata = talloc_zero(ctx, struct rpc_key);
+ W_ERROR_HAVE_NO_MEMORY(mykeydata);
mykeydata->key.context = ctx;
mykeydata->binding_handle = rctx->binding_handle;
mykeydata->num_values = -1;
@@ -160,6 +161,7 @@ static WERROR rpc_open_key(TALLOC_CTX *mem_ctx, struct registry_key *h,
NTSTATUS status;
mykeydata = talloc_zero(mem_ctx, struct rpc_key);
+ W_ERROR_HAVE_NO_MEMORY(mykeydata);
mykeydata->key.context = parentkeydata->key.context;
mykeydata->binding_handle = parentkeydata->binding_handle;
mykeydata->num_values = -1;
@@ -487,6 +489,7 @@ _PUBLIC_ WERROR reg_open_remote(struct registry_context **ctx,
dcerpc_init(lp_ctx);
rctx = talloc(NULL, struct rpc_registry_context);
+ W_ERROR_HAVE_NO_MEMORY(rctx);
/* Default to local smbd if no connection is specified */
if (!location) {
diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c
index fc59bdfdfa..b04dcc75cd 100644
--- a/source4/lib/registry/samba.c
+++ b/source4/lib/registry/samba.c
@@ -40,6 +40,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
location = talloc_asprintf(ctx, "%s/%s.ldb",
lp_private_dir(lp_ctx),
name);
+ W_ERROR_HAVE_NO_MEMORY(location);
error = reg_open_hive(ctx, location, auth_info, creds, event_ctx, lp_ctx, &hive);