summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/wrepld/parser.c10
-rw-r--r--source3/wrepld/process.c10
-rw-r--r--source3/wrepld/server.c6
3 files changed, 13 insertions, 13 deletions
diff --git a/source3/wrepld/parser.c b/source3/wrepld/parser.c
index b619cb0cef..915895507c 100644
--- a/source3/wrepld/parser.c
+++ b/source3/wrepld/parser.c
@@ -37,7 +37,7 @@ BOOL grow_buffer(struct BUFFER *buffer, int more)
more=256;
if (buffer->offset+more >= buffer->length) {
- temp=(char *)talloc_realloc(mem_ctx, buffer->buffer, sizeof(char)* (buffer->length+more) );
+ temp=talloc_realloc(mem_ctx, buffer->buffer, char, buffer->length + more);
if (temp==NULL) {
DEBUG(0,("grow_buffer: can't grow buffer\n"));
return False;
@@ -141,7 +141,7 @@ static void decode_wins_name(struct BUFFER *outbuf, WINS_NAME *wins_name)
outbuf->offset+=4;
if (wins_name->name_flag & 2) {
- wins_name->others=(struct in_addr *)talloc(mem_ctx, sizeof(struct in_addr)*wins_name->num_ip);
+ wins_name->others=talloc_array(mem_ctx, struct in_addr, wins_name->num_ip);
if (wins_name->others==NULL)
return;
@@ -172,7 +172,7 @@ static void decode_update_notify_request(struct BUFFER *inbuf, UPDATE_NOTIFY_REQ
un_rq->partner_count=RIVAL(inbuf->buffer, inbuf->offset);
inbuf->offset+=4;
- un_rq->wins_owner=(WINS_OWNER *)talloc(mem_ctx, un_rq->partner_count*sizeof(WINS_OWNER));
+ un_rq->wins_owner=talloc_array(mem_ctx, WINS_OWNER, un_rq->partner_count);
if (un_rq->wins_owner==NULL)
return;
@@ -205,7 +205,7 @@ static void decode_send_entries_reply(struct BUFFER *inbuf, SEND_ENTRIES_REPLY *
se_rp->max_names = RIVAL(inbuf->buffer, inbuf->offset);
inbuf->offset+=4;
- se_rp->wins_name=(WINS_NAME *)talloc(mem_ctx, se_rp->max_names*sizeof(WINS_NAME));
+ se_rp->wins_name=talloc_array(mem_ctx, WINS_NAME, se_rp->max_names);
if (se_rp->wins_name==NULL)
return;
@@ -226,7 +226,7 @@ static void decode_add_version_number_map_table_reply(struct BUFFER *inbuf, AVMT
avmt_rep->partner_count=RIVAL(inbuf->buffer, inbuf->offset);
inbuf->offset+=4;
- avmt_rep->wins_owner=(WINS_OWNER *)talloc(mem_ctx, avmt_rep->partner_count*sizeof(WINS_OWNER));
+ avmt_rep->wins_owner=talloc_array(mem_ctx, WINS_OWNER, avmt_rep->partner_count);
if (avmt_rep->wins_owner==NULL)
return;
diff --git a/source3/wrepld/process.c b/source3/wrepld/process.c
index 0e9a9b3461..7a94cdcafb 100644
--- a/source3/wrepld/process.c
+++ b/source3/wrepld/process.c
@@ -126,7 +126,7 @@ static void start_assoc_reply(GENERIC_PACKET *q, GENERIC_PACKET *r)
r->rep.msg_type=MESSAGE_REP_UPDATE_NOTIFY_REQUEST;
r->rep.un_rq.partner_count=partner_count;
- r->rep.un_rq.wins_owner=(WINS_OWNER *)talloc(mem_ctx, partner_count*sizeof(WINS_OWNER));
+ r->rep.un_rq.wins_owner=talloc_array(mem_ctx, WINS_OWNER, partner_count);
if (r->rep.un_rq.wins_owner==NULL) {
DEBUG(0,("start_assoc_reply: can't alloc memory\n"));
stop_packet(q, r, STOP_REASON_USER_REASON);
@@ -238,7 +238,7 @@ static void send_version_number_map_table(GENERIC_PACKET *q, GENERIC_PACKET *r)
*/
get_our_last_id(&global_wins_table[0][0]);
- r->rep.avmt_rep.wins_owner=(WINS_OWNER *)talloc(mem_ctx, partner_count*sizeof(WINS_OWNER));
+ r->rep.avmt_rep.wins_owner=talloc_array(mem_ctx, WINS_OWNER, partner_count);
if (r->rep.avmt_rep.wins_owner==NULL) {
stop_packet(q, r, STOP_REASON_USER_REASON);
return;
@@ -407,7 +407,7 @@ static BOOL add_record_to_winsname(WINS_NAME **wins_name, int *max_names, char *
int i;
int current=*max_names;
- temp_list=talloc_realloc(mem_ctx, *wins_name, (current+1)*sizeof(WINS_NAME));
+ temp_list=talloc_realloc(mem_ctx, *wins_name, WINS_NAME, current + 1);
if (temp_list==NULL)
return False;
@@ -431,7 +431,7 @@ static BOOL add_record_to_winsname(WINS_NAME **wins_name, int *max_names, char *
if (temp_list[current].name_flag & 2) {
temp_list[current].num_ip=num_ips;
- temp_list[current].others=(struct in_addr *)talloc(mem_ctx, sizeof(struct in_addr)*num_ips);
+ temp_list[current].others=talloc_array(mem_ctx, struct in_addr, num_ips);
if (temp_list[current].others==NULL)
return False;
@@ -540,7 +540,7 @@ static void send_entry_request(GENERIC_PACKET *q, GENERIC_PACKET *r)
wins_ip=*interpret_addr2(ip_str);
/* Allocate the space for the ip_list. */
- if((ip_list = (struct in_addr *)talloc(mem_ctx, num_ips * sizeof(struct in_addr))) == NULL) {
+ if((ip_list = talloc_array(mem_ctx, struct in_addr, num_ips)) == NULL) {
SAFE_FREE(dbuf.dptr);
DEBUG(0,("initialise_wins: talloc fail !\n"));
return;
diff --git a/source3/wrepld/server.c b/source3/wrepld/server.c
index 06fab1ab1a..59708dc8ba 100644
--- a/source3/wrepld/server.c
+++ b/source3/wrepld/server.c
@@ -295,8 +295,8 @@ static struct wins_packet_struct *read_wins_packet(int fd, int timeout)
total += ret;
}
- q = (GENERIC_PACKET *)talloc(mem_ctx, sizeof(GENERIC_PACKET));
- p = (struct wins_packet_struct *)talloc(mem_ctx, sizeof(*p));
+ q = talloc(mem_ctx, GENERIC_PACKET);
+ p = talloc(mem_ctx, struct wins_packet_struct);
if (q==NULL || p==NULL)
return NULL;
@@ -486,7 +486,7 @@ static void process(void)
}
/* free temp memory */
- talloc_destroy_pool(mem_ctx);
+ talloc_free_children(mem_ctx);
/* free up temp memory */
lp_talloc_free();