mirror of
https://github.com/samba-team/samba.git
synced 2025-11-14 12:23:52 +03:00
r2671: we're getting too many errors caused by the talloc_realloc() API not
taking a context (so when you pass a NULL pointer you end up with memory in a top level context). Fixed it by changing the API to take a context. The context is only used if the pointer you are reallocing is NULL.
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
d78eea9eb8
commit
8dc23821c9
@@ -184,7 +184,7 @@ static NTSTATUS ipv4_tcp_accept(struct socket_context *sock, struct socket_conte
|
||||
}
|
||||
|
||||
static NTSTATUS ipv4_tcp_recv(struct socket_context *sock, TALLOC_CTX *mem_ctx,
|
||||
DATA_BLOB *blob, size_t wantlen, uint32_t flags)
|
||||
DATA_BLOB *blob, size_t wantlen, uint32_t flags)
|
||||
{
|
||||
ssize_t gotlen;
|
||||
void *buf;
|
||||
@@ -235,7 +235,7 @@ static NTSTATUS ipv4_tcp_recv(struct socket_context *sock, TALLOC_CTX *mem_ctx,
|
||||
}
|
||||
|
||||
blob->length = gotlen;
|
||||
blob->data = talloc_realloc(buf, gotlen);
|
||||
blob->data = talloc_realloc(mem_ctx, buf, gotlen);
|
||||
if (!blob->data) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user