mirror of
https://github.com/samba-team/samba.git
synced 2025-01-22 22:04:08 +03:00
ctdb-client: Do not try to allocate 0 sized record
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13356 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net>
This commit is contained in:
parent
2610a3f2f7
commit
92a68af1a8
@ -1413,14 +1413,19 @@ struct ctdb_record_handle *ctdb_fetch_lock_recv(struct tevent_req *req,
|
||||
offset = ctdb_ltdb_header_len(&h->header);
|
||||
|
||||
data->dsize = h->data.dsize - offset;
|
||||
data->dptr = talloc_memdup(mem_ctx, h->data.dptr + offset,
|
||||
data->dsize);
|
||||
if (data->dptr == NULL) {
|
||||
TALLOC_FREE(state->h);
|
||||
if (perr != NULL) {
|
||||
*perr = ENOMEM;
|
||||
if (data->dsize == 0) {
|
||||
data->dptr = NULL;
|
||||
} else {
|
||||
data->dptr = talloc_memdup(mem_ctx,
|
||||
h->data.dptr + offset,
|
||||
data->dsize);
|
||||
if (data->dptr == NULL) {
|
||||
TALLOC_FREE(state->h);
|
||||
if (perr != NULL) {
|
||||
*perr = ENOMEM;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user