summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2007-12-09 19:46:06 +0100
committerJeremy Allison <jra@samba.org>2007-12-09 11:11:21 -0800
commit6bec071408c80a85dc2a7830d2cf4c48157b5187 (patch)
tree173acb54bcf1d75f20489b7ab0fa0bbe673dfd9f
parentd58868f2a474c29d954eb7e6ff8627b3d77d0544 (diff)
downloadsamba-6bec071408c80a85dc2a7830d2cf4c48157b5187.tar.gz
samba-6bec071408c80a85dc2a7830d2cf4c48157b5187.tar.bz2
samba-6bec071408c80a85dc2a7830d2cf4c48157b5187.zip
Don't copy the rpc function pointers
This actually shows up in a valgrind massif run with 4.1% of allocated memory. I don't see why we would have to make a copy here. Metze? (This used to be commit 616d6b97e594a846e9b3ac4cbe48538d649462e9)
-rw-r--r--source3/rpc_server/srv_pipe.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c
index 49ffcf13a6..5ede0c93f4 100644
--- a/source3/rpc_server/srv_pipe.c
+++ b/source3/rpc_server/srv_pipe.c
@@ -714,7 +714,7 @@ struct rpc_table {
const char *clnt;
const char *srv;
} pipe;
- struct api_struct *cmds;
+ const struct api_struct *cmds;
int n_cmds;
};
@@ -1075,12 +1075,8 @@ NTSTATUS rpc_pipe_register_commands(int version, const char *clnt, const char *s
ZERO_STRUCTP(rpc_entry);
rpc_entry->pipe.clnt = SMB_STRDUP(clnt);
rpc_entry->pipe.srv = SMB_STRDUP(srv);
- rpc_entry->cmds = SMB_REALLOC_ARRAY(rpc_entry->cmds, struct api_struct, rpc_entry->n_cmds + size);
- if (!rpc_entry->cmds) {
- return NT_STATUS_NO_MEMORY;
- }
- memcpy(rpc_entry->cmds + rpc_entry->n_cmds, cmds, size * sizeof(struct api_struct));
- rpc_entry->n_cmds += size;
+ rpc_entry->cmds = cmds;
+ rpc_entry->n_cmds = size;
return NT_STATUS_OK;
}