mirror of
https://github.com/samba-team/samba.git
synced 2025-08-29 13:49:30 +03:00
ctdb: Avoid a talloc in ctdb_queue_send
Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
committed by
Amitay Isaacs
parent
5907b0cc1e
commit
70c79f5140
@ -44,6 +44,7 @@ struct ctdb_queue_pkt {
|
|||||||
uint8_t *data;
|
uint8_t *data;
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
uint32_t full_length;
|
uint32_t full_length;
|
||||||
|
uint8_t buf[];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ctdb_queue {
|
struct ctdb_queue {
|
||||||
@ -324,11 +325,13 @@ int ctdb_queue_send(struct ctdb_queue *queue, uint8_t *data, uint32_t length)
|
|||||||
if (length2 == 0) return 0;
|
if (length2 == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkt = talloc(queue, struct ctdb_queue_pkt);
|
pkt = talloc_size(
|
||||||
|
queue, offsetof(struct ctdb_queue_pkt, buf) + length2);
|
||||||
CTDB_NO_MEMORY(queue->ctdb, pkt);
|
CTDB_NO_MEMORY(queue->ctdb, pkt);
|
||||||
|
talloc_set_name_const(pkt, "struct ctdb_queue_pkt");
|
||||||
|
|
||||||
pkt->data = talloc_memdup(pkt, data, length2);
|
pkt->data = pkt->buf;
|
||||||
CTDB_NO_MEMORY(queue->ctdb, pkt->data);
|
memcpy(pkt->data, data, length2);
|
||||||
|
|
||||||
pkt->length = length2;
|
pkt->length = length2;
|
||||||
pkt->full_length = full_length;
|
pkt->full_length = full_length;
|
||||||
|
Reference in New Issue
Block a user