diff options
author | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2010-03-22 12:15:19 +0100 |
---|---|---|
committer | Matthias Dieter Wallnöfer <mwallnoefer@yahoo.de> | 2010-03-22 12:26:40 +0100 |
commit | 6f7f16dc80000ccea582036dc58ce81ea9f078b0 (patch) | |
tree | 05ea4eca1c16e2fc7923ca0cb8963dec8078c76f /source4/lib/registry | |
parent | 93472b41dedd8e30be8752c271f2b4bca392176a (diff) | |
download | samba-6f7f16dc80000ccea582036dc58ce81ea9f078b0.tar.gz samba-6f7f16dc80000ccea582036dc58ce81ea9f078b0.tar.bz2 samba-6f7f16dc80000ccea582036dc58ce81ea9f078b0.zip |
s4:registry - "patchfile_preg.c" - also here don't accumulate the memory usage
Free always the unused stuff.
Diffstat (limited to 'source4/lib/registry')
-rw-r--r-- | source4/lib/registry/patchfile_preg.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/source4/lib/registry/patchfile_preg.c b/source4/lib/registry/patchfile_preg.c index d7b4bc3730..c75b08dbe1 100644 --- a/source4/lib/registry/patchfile_preg.c +++ b/source4/lib/registry/patchfile_preg.c @@ -88,15 +88,23 @@ static WERROR reg_preg_diff_del_key(void *_data, const char *key_name) struct preg_data *data = (struct preg_data *)_data; char *parent_name; DATA_BLOB blob; + WERROR werr; parent_name = talloc_strndup(data->ctx, key_name, strrchr(key_name, '\\')-key_name); + W_ERROR_HAVE_NO_MEMORY(parent_name); blob.data = (uint8_t *)talloc_strndup(data->ctx, key_name+(strrchr(key_name, '\\')-key_name)+1, strlen(key_name)-(strrchr(key_name, '\\')-key_name)); + W_ERROR_HAVE_NO_MEMORY(blob.data); blob.length = strlen((char *)blob.data)+1; /* FIXME: These values should be accumulated to be written at done(). */ - return reg_preg_diff_set_value(data, parent_name, "**DeleteKeys", REG_SZ, blob); + werr = reg_preg_diff_set_value(data, parent_name, "**DeleteKeys", REG_SZ, blob); + + talloc_free(parent_name); + talloc_free(blob.data); + + return werr; } static WERROR reg_preg_diff_del_value(void *_data, const char *key_name, @@ -105,25 +113,39 @@ static WERROR reg_preg_diff_del_value(void *_data, const char *key_name, struct preg_data *data = (struct preg_data *)_data; char *val; DATA_BLOB blob; + WERROR werr; val = talloc_asprintf(data->ctx, "**Del.%s", value_name); - + W_ERROR_HAVE_NO_MEMORY(val); blob.data = (uint8_t *)talloc(data->ctx, uint32_t); + W_ERROR_HAVE_NO_MEMORY(blob.data); SIVAL(blob.data, 0, 0); blob.length = 4; - return reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob); + + werr = reg_preg_diff_set_value(data, key_name, val, REG_DWORD, blob); + + talloc_free(val); + talloc_free(blob.data); + + return werr; } static WERROR reg_preg_diff_del_all_values(void *_data, const char *key_name) { struct preg_data *data = (struct preg_data *)_data; DATA_BLOB blob; + WERROR werr; blob.data = (uint8_t *)talloc(data->ctx, uint32_t); + W_ERROR_HAVE_NO_MEMORY(blob.data); SIVAL(blob.data, 0, 0); blob.length = 4; - return reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob); + werr = reg_preg_diff_set_value(data, key_name, "**DelVals.", REG_DWORD, blob); + + talloc_free(blob.data); + + return werr; } static WERROR reg_preg_diff_done(void *_data) |