diff options
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/clilist.c | 8 | ||||
-rw-r--r-- | source4/libcli/ldap/ldap.c | 2 | ||||
-rw-r--r-- | source4/libcli/ldap/ldap_ldif.c | 11 | ||||
-rw-r--r-- | source4/libcli/raw/clisession.c | 2 | ||||
-rw-r--r-- | source4/libcli/raw/clisocket.c | 2 | ||||
-rw-r--r-- | source4/libcli/raw/clitransport.c | 8 | ||||
-rw-r--r-- | source4/libcli/raw/clitree.c | 2 | ||||
-rw-r--r-- | source4/libcli/raw/raweas.c | 2 | ||||
-rw-r--r-- | source4/libcli/raw/rawfile.c | 6 | ||||
-rw-r--r-- | source4/libcli/raw/rawfileinfo.c | 2 | ||||
-rw-r--r-- | source4/libcli/raw/rawreadwrite.c | 4 | ||||
-rw-r--r-- | source4/libcli/raw/rawrequest.c | 4 | ||||
-rw-r--r-- | source4/libcli/raw/rawtrans.c | 4 |
13 files changed, 28 insertions, 29 deletions
diff --git a/source4/libcli/clilist.c b/source4/libcli/clilist.c index e2c267cc96..0e2cdabc0a 100644 --- a/source4/libcli/clilist.c +++ b/source4/libcli/clilist.c @@ -83,8 +83,8 @@ static BOOL smbcli_list_new_callback(void *private, union smb_search_data *file) file_info *tdl; /* add file info to the dirlist pool */ - tdl = talloc_realloc(state->mem_ctx, state->dirlist, - state->dirlist_len + sizeof(struct file_info)); + tdl = talloc_realloc(state->dirlist, + state->dirlist_len + sizeof(struct file_info)); if (!tdl) { return False; @@ -225,8 +225,8 @@ static BOOL smbcli_list_old_callback(void *private, union smb_search_data *file) file_info *tdl; /* add file info to the dirlist pool */ - tdl = talloc_realloc(state->mem_ctx, state->dirlist, - state->dirlist_len + sizeof(struct file_info)); + tdl = talloc_realloc(state->dirlist, + state->dirlist_len + sizeof(struct file_info)); if (!tdl) { return False; diff --git a/source4/libcli/ldap/ldap.c b/source4/libcli/ldap/ldap.c index 123def9416..7e60e48293 100644 --- a/source4/libcli/ldap/ldap.c +++ b/source4/libcli/ldap/ldap.c @@ -179,7 +179,7 @@ static struct ldap_parse_tree *ldap_parse_filterlist(TALLOC_CTX *mem_ctx, while (*s && (next = ldap_parse_filter(mem_ctx, &s))) { struct ldap_parse_tree **e; - e = talloc_realloc(mem_ctx, ret->u.list.elements, + e = talloc_realloc(ret->u.list.elements, sizeof(struct ldap_parse_tree) * (ret->u.list.num_elements+1)); if (!e) { diff --git a/source4/libcli/ldap/ldap_ldif.c b/source4/libcli/ldap/ldap_ldif.c index 2f23dd16a6..2ec3b827ce 100644 --- a/source4/libcli/ldap/ldap_ldif.c +++ b/source4/libcli/ldap/ldap_ldif.c @@ -51,7 +51,7 @@ static char *next_chunk(TALLOC_CTX *mem_ctx, if (chunk_size+1 >= alloc_size) { char *c2; alloc_size += 1024; - c2 = talloc_realloc(mem_ctx, chunk, alloc_size); + c2 = talloc_realloc(chunk, alloc_size); if (!c2) { errno = ENOMEM; return NULL; @@ -158,7 +158,7 @@ static int next_attr(char **s, const char **attr, struct ldap_val *value) BOOL add_value_to_attrib(TALLOC_CTX *mem_ctx, struct ldap_val *value, struct ldap_attribute *attrib) { - attrib->values = talloc_realloc(mem_ctx, attrib->values, + attrib->values = talloc_realloc(attrib->values, sizeof(*attrib->values) * (attrib->num_values+1)); if (attrib->values == NULL) @@ -175,7 +175,7 @@ BOOL add_attrib_to_array_talloc(TALLOC_CTX *mem_ctx, struct ldap_attribute **attribs, int *num_attribs) { - *attribs = talloc_realloc(mem_ctx, *attribs, + *attribs = talloc_realloc(*attribs, sizeof(**attribs) * (*num_attribs+1)); if (*attribs == NULL) @@ -207,8 +207,7 @@ static BOOL fill_add_attributes(struct ldap_message *msg, char **chunk) } if (attrib == NULL) { - r->attributes = talloc_realloc(msg->mem_ctx, - r->attributes, + r->attributes = talloc_realloc(r->attributes, sizeof(*r->attributes) * (r->num_attributes+1)); if (r->attributes == NULL) @@ -232,7 +231,7 @@ BOOL add_mod_to_array_talloc(TALLOC_CTX *mem_ctx, struct ldap_mod **mods, int *num_mods) { - *mods = talloc_realloc(mem_ctx, *mods, + *mods = talloc_realloc(*mods, sizeof(**mods) * ((*num_mods)+1)); if (*mods == NULL) diff --git a/source4/libcli/raw/clisession.c b/source4/libcli/raw/clisession.c index f46c238378..0ee631a549 100644 --- a/source4/libcli/raw/clisession.c +++ b/source4/libcli/raw/clisession.c @@ -69,7 +69,7 @@ void smbcli_session_close(struct smbcli_session *session) ****************************************************************************/ struct smbcli_request *smb_raw_session_setup_send(struct smbcli_session *session, union smb_sesssetup *parms) { - struct smbcli_request *req; + struct smbcli_request *req = NULL; switch (parms->generic.level) { case RAW_SESSSETUP_GENERIC: diff --git a/source4/libcli/raw/clisocket.c b/source4/libcli/raw/clisocket.c index 343904999a..2bb50d200f 100644 --- a/source4/libcli/raw/clisocket.c +++ b/source4/libcli/raw/clisocket.c @@ -181,7 +181,7 @@ BOOL smbcli_sock_connect_byname(struct smbcli_socket *sock, const char *host, in ret = smbcli_sock_connect(sock, &ip, port); if (ret) { - sock->hostname = talloc_steal(mem_ctx, sock->mem_ctx, name); + sock->hostname = talloc_steal(sock->mem_ctx, name); } talloc_destroy(mem_ctx); diff --git a/source4/libcli/raw/clitransport.c b/source4/libcli/raw/clitransport.c index 91f0f0f8f5..82939467ae 100644 --- a/source4/libcli/raw/clitransport.c +++ b/source4/libcli/raw/clitransport.c @@ -296,7 +296,7 @@ static void smbcli_transport_finish_recv(struct smbcli_transport *transport) { uint8_t *buffer, *hdr, *vwv; int len; - uint16_t wct, mid = 0; + uint16_t wct=0, mid = 0; struct smbcli_request *req; buffer = transport->recv_buffer.buffer; @@ -309,7 +309,7 @@ static void smbcli_transport_finish_recv(struct smbcli_transport *transport) /* see if it could be an oplock break request */ if (handle_oplock_break(transport, len, hdr, vwv)) { - talloc_free(transport->mem_ctx, buffer); + talloc_free(buffer); return; } @@ -325,7 +325,7 @@ static void smbcli_transport_finish_recv(struct smbcli_transport *transport) if (!req) goto error; req->in.buffer = buffer; - talloc_steal(transport->mem_ctx, req->mem_ctx, buffer); + talloc_steal(req->mem_ctx, buffer); req->in.size = len; req->in.allocated = req->in.size; goto async; @@ -349,7 +349,7 @@ static void smbcli_transport_finish_recv(struct smbcli_transport *transport) /* fill in the 'in' portion of the matching request */ req->in.buffer = buffer; - talloc_steal(transport->mem_ctx, req->mem_ctx, buffer); + talloc_steal(req->mem_ctx, buffer); req->in.size = len; req->in.allocated = req->in.size; diff --git a/source4/libcli/raw/clitree.c b/source4/libcli/raw/clitree.c index 97c0910451..57e322da32 100644 --- a/source4/libcli/raw/clitree.c +++ b/source4/libcli/raw/clitree.c @@ -70,7 +70,7 @@ void smbcli_tree_close(struct smbcli_tree *tree) ****************************************************************************/ struct smbcli_request *smb_tree_connect_send(struct smbcli_tree *tree, union smb_tcon *parms) { - struct smbcli_request *req; + struct smbcli_request *req = NULL; switch (parms->tcon.level) { case RAW_TCON_TCON: diff --git a/source4/libcli/raw/raweas.c b/source4/libcli/raw/raweas.c index e07fbcd288..d78f10fe1a 100644 --- a/source4/libcli/raw/raweas.c +++ b/source4/libcli/raw/raweas.c @@ -128,7 +128,7 @@ NTSTATUS ea_pull_list(const DATA_BLOB *blob, blob2.data = blob->data + ofs; blob2.length = ea_size - ofs; - *eas = talloc_realloc(mem_ctx, *eas, sizeof(**eas) * (n+1)); + *eas = talloc_realloc(*eas, sizeof(**eas) * (n+1)); if (! *eas) return NT_STATUS_NO_MEMORY; len = ea_pull_struct(&blob2, mem_ctx, &(*eas)[n]); diff --git a/source4/libcli/raw/rawfile.c b/source4/libcli/raw/rawfile.c index 8bd8e5d8af..1b858d489a 100644 --- a/source4/libcli/raw/rawfile.c +++ b/source4/libcli/raw/rawfile.c @@ -34,7 +34,7 @@ struct smbcli_request *smb_raw_rename_send(struct smbcli_tree *tree, union smb_rename *parms) { - struct smbcli_request *req; + struct smbcli_request *req = NULL; switch (parms->generic.level) { case RAW_RENAME_RENAME: @@ -490,7 +490,7 @@ NTSTATUS smb_raw_open(struct smbcli_tree *tree, TALLOC_CTX *mem_ctx, union smb_o ****************************************************************************/ struct smbcli_request *smb_raw_close_send(struct smbcli_tree *tree, union smb_close *parms) { - struct smbcli_request *req; + struct smbcli_request *req = NULL; switch (parms->generic.level) { case RAW_CLOSE_GENERIC: @@ -536,7 +536,7 @@ NTSTATUS smb_raw_close(struct smbcli_tree *tree, union smb_close *parms) ****************************************************************************/ struct smbcli_request *smb_raw_lock_send(struct smbcli_tree *tree, union smb_lock *parms) { - struct smbcli_request *req; + struct smbcli_request *req = NULL; switch (parms->generic.level) { case RAW_LOCK_GENERIC: diff --git a/source4/libcli/raw/rawfileinfo.c b/source4/libcli/raw/rawfileinfo.c index 9b82bf6fa0..aac8f2657b 100644 --- a/source4/libcli/raw/rawfileinfo.c +++ b/source4/libcli/raw/rawfileinfo.c @@ -174,7 +174,7 @@ static NTSTATUS smb_raw_info_backend(struct smbcli_session *session, while (blob->length - ofs >= 24) { uint_t n = parms->stream_info.out.num_streams; parms->stream_info.out.streams = - talloc_realloc(mem_ctx,parms->stream_info.out.streams, + talloc_realloc(parms->stream_info.out.streams, (n+1) * sizeof(parms->stream_info.out.streams[0])); if (!parms->stream_info.out.streams) { return NT_STATUS_NO_MEMORY; diff --git a/source4/libcli/raw/rawreadwrite.c b/source4/libcli/raw/rawreadwrite.c index f0a9a063ed..dbca6fb7a5 100644 --- a/source4/libcli/raw/rawreadwrite.c +++ b/source4/libcli/raw/rawreadwrite.c @@ -33,7 +33,7 @@ struct smbcli_request *smb_raw_read_send(struct smbcli_tree *tree, union smb_read *parms) { BOOL bigoffset = False; - struct smbcli_request *req; + struct smbcli_request *req = NULL; switch (parms->generic.level) { case RAW_READ_GENERIC: @@ -185,7 +185,7 @@ NTSTATUS smb_raw_read(struct smbcli_tree *tree, union smb_read *parms) struct smbcli_request *smb_raw_write_send(struct smbcli_tree *tree, union smb_write *parms) { BOOL bigoffset = False; - struct smbcli_request *req; + struct smbcli_request *req = NULL; switch (parms->generic.level) { case RAW_WRITE_GENERIC: diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index bc87af4297..20a389af4c 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -224,7 +224,7 @@ static void smbcli_req_grow_allocation(struct smbcli_request *req, uint_t new_si /* we need to realloc */ req->out.allocated = req->out.size + delta + REQ_OVER_ALLOCATION; - buf2 = talloc_realloc(req->mem_ctx, req->out.buffer, req->out.allocated); + buf2 = talloc_realloc(req->out.buffer, req->out.allocated); if (buf2 == NULL) { smb_panic("out of memory in req_grow_allocation"); } @@ -915,7 +915,7 @@ size_t smbcli_blob_append_string(struct smbcli_session *session, max_len = (strlen(str)+2) * MAX_BYTES_PER_CHAR; - blob->data = talloc_realloc(mem_ctx, blob->data, blob->length + max_len); + blob->data = talloc_realloc(blob->data, blob->length + max_len); if (!blob->data) { return 0; } diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c index 53f8075822..49b43dd930 100644 --- a/source4/libcli/raw/rawtrans.c +++ b/source4/libcli/raw/rawtrans.c @@ -84,7 +84,7 @@ NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req, /* allocate it */ if (total_data != 0) { - tdata = talloc_realloc(mem_ctx, parms->out.data.data,total_data); + tdata = talloc_realloc(parms->out.data.data,total_data); if (!tdata) { DEBUG(0,("smb_raw_receive_trans: failed to enlarge data buffer to %d bytes\n", total_data)); req->status = NT_STATUS_NO_MEMORY; @@ -94,7 +94,7 @@ NTSTATUS smb_raw_trans2_recv(struct smbcli_request *req, } if (total_param != 0) { - tparam = talloc_realloc(mem_ctx, parms->out.params.data,total_param); + tparam = talloc_realloc(parms->out.params.data,total_param); if (!tparam) { DEBUG(0,("smb_raw_receive_trans: failed to enlarge param buffer to %d bytes\n", total_param)); req->status = NT_STATUS_NO_MEMORY; |