Fix for allDCB linked list corruption.
This commit is contained in:
@ -122,6 +122,7 @@ if ((rval = calloc(1, sizeof(DCB))) == NULL)
|
|||||||
memset(&rval->stats, 0, sizeof(DCBSTATS)); // Zero the statistics
|
memset(&rval->stats, 0, sizeof(DCBSTATS)); // Zero the statistics
|
||||||
rval->state = DCB_STATE_ALLOC;
|
rval->state = DCB_STATE_ALLOC;
|
||||||
bitmask_init(&rval->memdata.bitmask);
|
bitmask_init(&rval->memdata.bitmask);
|
||||||
|
rval->next = NULL;
|
||||||
|
|
||||||
spinlock_acquire(&dcbspin);
|
spinlock_acquire(&dcbspin);
|
||||||
if (allDCBs == NULL)
|
if (allDCBs == NULL)
|
||||||
@ -137,6 +138,26 @@ if ((rval = calloc(1, sizeof(DCB))) == NULL)
|
|||||||
return rval;
|
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.
|
* Add the DCB to the end of zombies list.
|
||||||
*
|
*
|
||||||
|
@ -121,7 +121,7 @@ GWPROTOCOL *funcs;
|
|||||||
if ((funcs =
|
if ((funcs =
|
||||||
(GWPROTOCOL *)load_module(port->protocol, MODULE_PROTOCOL)) == NULL)
|
(GWPROTOCOL *)load_module(port->protocol, MODULE_PROTOCOL)) == NULL)
|
||||||
{
|
{
|
||||||
free(port->listener);
|
dcb_free(port->listener);
|
||||||
port->listener = NULL;
|
port->listener = NULL;
|
||||||
LOGIF(LE, (skygw_log_write_flush(
|
LOGIF(LE, (skygw_log_write_flush(
|
||||||
LOGFILE_ERROR,
|
LOGFILE_ERROR,
|
||||||
|
Reference in New Issue
Block a user