mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-28 21:17:54 +00:00
3531. [bug] win32: A uninitialized value could be returned on out
of memory. [RT #32960]
This commit is contained in:
parent
ee2a7c7bf6
commit
c82da2167d
3
CHANGES
3
CHANGES
@ -1,3 +1,6 @@
|
|||||||
|
3531. [bug] win32: A uninitialized value could be returned on out
|
||||||
|
of memory. [RT #32960]
|
||||||
|
|
||||||
3530. [contrib] Better RTT tracking in queryperf. [RT #30128]
|
3530. [contrib] Better RTT tracking in queryperf. [RT #30128]
|
||||||
|
|
||||||
3529. [func] Named now listens on both IPv4 and IPv6 interfaces
|
3529. [func] Named now listens on both IPv4 and IPv6 interfaces
|
||||||
|
@ -2104,7 +2104,7 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
|
|||||||
sock->sendcmsgbuf = NULL;
|
sock->sendcmsgbuf = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set up cmsg buffers
|
* Set up cmsg buffers.
|
||||||
*/
|
*/
|
||||||
cmsgbuflen = 0;
|
cmsgbuflen = 0;
|
||||||
#if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIN6PKTINFO)
|
#if defined(USE_CMSG) && defined(ISC_PLATFORM_HAVEIN6PKTINFO)
|
||||||
@ -2146,7 +2146,7 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
|
|||||||
sock->tag = NULL;
|
sock->tag = NULL;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set up list of readers and writers to be initially empty
|
* Set up list of readers and writers to be initially empty.
|
||||||
*/
|
*/
|
||||||
ISC_LIST_INIT(sock->recv_list);
|
ISC_LIST_INIT(sock->recv_list);
|
||||||
ISC_LIST_INIT(sock->send_list);
|
ISC_LIST_INIT(sock->send_list);
|
||||||
@ -2161,7 +2161,7 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
|
|||||||
sock->bound = 0;
|
sock->bound = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize the lock
|
* Initialize the lock.
|
||||||
*/
|
*/
|
||||||
result = isc_mutex_init(&sock->lock);
|
result = isc_mutex_init(&sock->lock);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
@ -2171,7 +2171,7 @@ allocate_socket(isc__socketmgr_t *manager, isc_sockettype_t type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Initialize readable and writable events
|
* Initialize readable and writable events.
|
||||||
*/
|
*/
|
||||||
ISC_EVENT_INIT(&sock->readable_ev, sizeof(intev_t),
|
ISC_EVENT_INIT(&sock->readable_ev, sizeof(intev_t),
|
||||||
ISC_EVENTATTR_NOPURGE, NULL, ISC_SOCKEVENT_INTR,
|
ISC_EVENTATTR_NOPURGE, NULL, ISC_SOCKEVENT_INTR,
|
||||||
|
@ -1466,7 +1466,7 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
|||||||
ISC_LINK_INIT(sock, link);
|
ISC_LINK_INIT(sock, link);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* set up list of readers and writers to be initially empty
|
* Set up list of readers and writers to be initially empty.
|
||||||
*/
|
*/
|
||||||
ISC_LIST_INIT(sock->recv_list);
|
ISC_LIST_INIT(sock->recv_list);
|
||||||
ISC_LIST_INIT(sock->send_list);
|
ISC_LIST_INIT(sock->send_list);
|
||||||
@ -1489,20 +1489,16 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
|||||||
sock->recvbuf.remaining = 0;
|
sock->recvbuf.remaining = 0;
|
||||||
sock->recvbuf.base = isc_mem_get(manager->mctx, sock->recvbuf.len); // max buffer size
|
sock->recvbuf.base = isc_mem_get(manager->mctx, sock->recvbuf.len); // max buffer size
|
||||||
if (sock->recvbuf.base == NULL) {
|
if (sock->recvbuf.base == NULL) {
|
||||||
sock->magic = 0;
|
result = ISC_R_NOMEMORY;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* initialize the lock
|
* Initialize the lock.
|
||||||
*/
|
*/
|
||||||
result = isc_mutex_init(&sock->lock);
|
result = isc_mutex_init(&sock->lock);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS)
|
||||||
sock->magic = 0;
|
|
||||||
isc_mem_put(manager->mctx, sock->recvbuf.base, sock->recvbuf.len);
|
|
||||||
sock->recvbuf.base = NULL;
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
|
||||||
|
|
||||||
socket_log(__LINE__, sock, NULL, EVENT, NULL, 0, 0,
|
socket_log(__LINE__, sock, NULL, EVENT, NULL, 0, 0,
|
||||||
"allocated");
|
"allocated");
|
||||||
@ -1513,6 +1509,8 @@ allocate_socket(isc_socketmgr_t *manager, isc_sockettype_t type,
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
|
|
||||||
error:
|
error:
|
||||||
|
if (sock->recvbuf.base != NULL)
|
||||||
|
isc_mem_put(manager->mctx, sock->recvbuf.base, sock->recvbuf.len);
|
||||||
isc_mem_put(manager->mctx, sock, sizeof(*sock));
|
isc_mem_put(manager->mctx, sock, sizeof(*sock));
|
||||||
|
|
||||||
return (result);
|
return (result);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user