Fix for allDCB linked list corruption.
This commit is contained in:
parent
0c4b53e9ef
commit
a91c595dbc
@ -99,7 +99,7 @@ DCB * dcb_alloc(
|
||||
{
|
||||
DCB *rval;
|
||||
|
||||
if ((rval = calloc(1, sizeof(DCB))) == NULL)
|
||||
if ((rval = calloc(1, sizeof(DCB))) == NULL)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
@ -122,6 +122,7 @@ if ((rval = calloc(1, sizeof(DCB))) == NULL)
|
||||
memset(&rval->stats, 0, sizeof(DCBSTATS)); // Zero the statistics
|
||||
rval->state = DCB_STATE_ALLOC;
|
||||
bitmask_init(&rval->memdata.bitmask);
|
||||
rval->next = NULL;
|
||||
|
||||
spinlock_acquire(&dcbspin);
|
||||
if (allDCBs == NULL)
|
||||
@ -137,6 +138,26 @@ if ((rval = calloc(1, sizeof(DCB))) == NULL)
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Free a DCB that has not been associated with a decriptor.
|
||||
*
|
||||
* @param dcb The DCB to free
|
||||
*/
|
||||
void
|
||||
dcb_free(DCB *dcb)
|
||||
{
|
||||
if (dcb->fd == -1)
|
||||
dcb_final_free(dcb);
|
||||
else
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Attempt to free a DCB via dcb_fee "
|
||||
"that has been associated with a descriptor.")));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the DCB to the end of zombies list.
|
||||
*
|
||||
|
@ -121,7 +121,7 @@ GWPROTOCOL *funcs;
|
||||
if ((funcs =
|
||||
(GWPROTOCOL *)load_module(port->protocol, MODULE_PROTOCOL)) == NULL)
|
||||
{
|
||||
free(port->listener);
|
||||
dcb_free(port->listener);
|
||||
port->listener = NULL;
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
|
Loading…
x
Reference in New Issue
Block a user