summaryrefslogtreecommitdiff
path: root/source3/modules
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2014-06-30 14:40:14 +0200
committerJeremy Allison <jra@samba.org>2014-06-30 21:41:12 +0200
commitf0f18c56c68325e9a1cf9b422d270a8787c980ba (patch)
tree728ffbeec7693c43b8665cd389c8e3f73c3b9a52 /source3/modules
parent224e1c105be2ecf2c02ca9cd3e8bb9660ea932aa (diff)
downloadsamba-f0f18c56c68325e9a1cf9b422d270a8787c980ba.tar.gz
vfs_snapper: use a talloc hierarchy for arrays
Currently the config and snapshot array entries are freed individually. A talloc hierarchy can be used to avoid this behaviour. Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Mon Jun 30 21:41:13 CEST 2014 on sn-devel-104
Diffstat (limited to 'source3/modules')
-rw-r--r--source3/modules/vfs_snapper.c32
1 files changed, 5 insertions, 27 deletions
diff --git a/source3/modules/vfs_snapper.c b/source3/modules/vfs_snapper.c
index 4ee77dfde33..f0f0b5c5578 100644
--- a/source3/modules/vfs_snapper.c
+++ b/source3/modules/vfs_snapper.c
@@ -326,17 +326,6 @@ static NTSTATUS snapper_conf_unpack(TALLOC_CTX *mem_ctx,
return status;
}
-static void snapper_conf_array_free(int32_t num_confs,
- struct snapper_conf *confs)
-{
- int i;
-
- for (i = 0; i < num_confs; i++) {
- talloc_free(confs[i].attrs);
- }
- talloc_free(confs);
-}
-
static struct snapper_conf *snapper_conf_array_base_find(int32_t num_confs,
struct snapper_conf *confs,
const char *base)
@@ -393,7 +382,7 @@ static NTSTATUS snapper_conf_array_unpack(TALLOC_CTX *mem_ctx,
if (confs == NULL)
abort();
- status = snapper_conf_unpack(mem_ctx, &array_iter,
+ status = snapper_conf_unpack(confs, &array_iter,
&confs[num_confs - 1]);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(confs);
@@ -558,17 +547,6 @@ static NTSTATUS snapper_snap_struct_unpack(TALLOC_CTX *mem_ctx,
return status;
}
-static void snapper_snap_array_free(int32_t num_snaps,
- struct snapper_snap *snaps)
-{
- int i;
-
- for (i = 0; i < num_snaps; i++) {
- talloc_free(snaps[i].user_data);
- }
- talloc_free(snaps);
-}
-
static void snapper_snap_array_print(int32_t num_snaps,
struct snapper_snap *snaps)
{
@@ -620,7 +598,7 @@ static NTSTATUS snapper_snap_array_unpack(TALLOC_CTX *mem_ctx,
if (snaps == NULL)
abort();
- status = snapper_snap_struct_unpack(mem_ctx, &array_iter,
+ status = snapper_snap_struct_unpack(snaps, &array_iter,
&snaps[num_snaps - 1]);
if (!NT_STATUS_IS_OK(status)) {
talloc_free(snaps);
@@ -803,7 +781,7 @@ static NTSTATUS snapper_get_conf_call(TALLOC_CTX *mem_ctx,
goto err_conf_name_free;
}
- snapper_conf_array_free(num_confs, confs);
+ talloc_free(confs);
dbus_message_unref(rsp_msg);
dbus_message_unref(req_msg);
@@ -815,7 +793,7 @@ static NTSTATUS snapper_get_conf_call(TALLOC_CTX *mem_ctx,
err_conf_name_free:
talloc_free(conf_name);
err_array_free:
- snapper_conf_array_free(num_confs, confs);
+ talloc_free(confs);
err_rsp_free:
dbus_message_unref(rsp_msg);
err_req_free:
@@ -1069,7 +1047,7 @@ static NTSTATUS snapper_get_snap_at_time_call(TALLOC_CTX *mem_ctx,
*snap_path_out = snap_path;
err_snap_array_free:
- snapper_snap_array_free(num_snaps, snaps);
+ talloc_free(snaps);
err_rsp_free:
dbus_message_unref(rsp_msg);
err_req_free: