diff options
author | Tim Potter <tpot@samba.org> | 2002-11-19 01:12:44 +0000 |
---|---|---|
committer | Tim Potter <tpot@samba.org> | 2002-11-19 01:12:44 +0000 |
commit | 1c5ffbd0aca045e5d480cf75a08d87f8199f1699 (patch) | |
tree | 7b75d8a7e75795589442108af735e35386f4da2b /source3/rpc_client | |
parent | 09cc065c3163bd7aff30e0923b47ec3b151ad8bd (diff) | |
download | samba-1c5ffbd0aca045e5d480cf75a08d87f8199f1699.tar.gz samba-1c5ffbd0aca045e5d480cf75a08d87f8199f1699.tar.bz2 samba-1c5ffbd0aca045e5d480cf75a08d87f8199f1699.zip |
Merge from appliance:
>Fix memory leak in cli_ds_getprimarydominfo()
(This used to be commit ca689916da200f2d772b007a913665a6b7df5bd7)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r-- | source3/rpc_client/cli_ds.c | 22 |
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; } - |