summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-11-19 01:14:00 +0000
committerTim Potter <tpot@samba.org>2002-11-19 01:14:00 +0000
commitb2201f2f397a1869c1e26f957e638fe6517aa04f (patch)
tree6c83ecf7f05a61a96e369b0a7f3789ce533b84bc /source3
parentd797c7986e071acbdecfab934fa7daac0a8321df (diff)
downloadsamba-b2201f2f397a1869c1e26f957e638fe6517aa04f.tar.gz
samba-b2201f2f397a1869c1e26f957e638fe6517aa04f.tar.bz2
samba-b2201f2f397a1869c1e26f957e638fe6517aa04f.zip
Merge from appliance:
>Fix memory leak in cli_ds_getprimarydominfo() (This used to be commit e643003dd4666d532604d86050d77f8b4212877e)
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_client/cli_ds.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/source3/rpc_client/cli_ds.c b/source3/rpc_client/cli_ds.c
index d6985bf876..46e24b7a84 100644
--- a/source3/rpc_client/cli_ds.c
+++ b/source3/rpc_client/cli_ds.c
@@ -22,8 +22,8 @@
/* implementations of client side DsXXX() functions */
-NTSTATUS cli_ds_getprimarydominfo( struct cli_state *cli, TALLOC_CTX *mem_ctx,
- uint16 level, DS_DOMINFO_CTR *ctr)
+NTSTATUS cli_ds_getprimarydominfo(struct cli_state *cli, TALLOC_CTX *mem_ctx,
+ uint16 level, DS_DOMINFO_CTR *ctr)
{
prs_struct qbuf, rbuf;
DS_Q_GETPRIMDOMINFO q;
@@ -41,8 +41,7 @@ NTSTATUS cli_ds_getprimarydominfo( struct cli_state *cli, TALLOC_CTX *mem_ctx,
q.level = level;
if (!ds_io_q_getprimdominfo("", &q, &qbuf, 0)
- || !rpc_api_pipe_req(cli, DS_GETPRIMDOMINFO, &qbuf, &rbuf))
- {
+ || !rpc_api_pipe_req(cli, DS_GETPRIMDOMINFO, &qbuf, &rbuf)) {
result = NT_STATUS_UNSUCCESSFUL;
goto done;
}
@@ -54,10 +53,21 @@ NTSTATUS cli_ds_getprimarydominfo( struct cli_state *cli, TALLOC_CTX *mem_ctx,
goto done;
}
- memcpy( ctr, &r.info, sizeof(DS_DOMINFO_CTR) );
+ /* Return basic info - if we are requesting at info != 1 then
+ there could be trouble. */
+
result = r.status;
+
+ if (ctr) {
+ ctr->basic = talloc(mem_ctx, sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC));
+ if (!ctr->basic)
+ goto done;
+ memcpy(ctr->basic, &r.info.basic, sizeof(DSROLE_PRIMARY_DOMAIN_INFO_BASIC));
+ }
done:
+ prs_mem_free(&qbuf);
+ prs_mem_free(&rbuf);
+
return result;
}
-