Fixed memory leak in the DCB bitmask
This commit is contained in:
@ -183,6 +183,7 @@ dcb_final_free(DCB *dcb)
|
||||
free(dcb->data);
|
||||
if (dcb->remote)
|
||||
free(dcb->remote);
|
||||
bitmask_free(&dcb->memdata.bitmask);
|
||||
free(dcb);
|
||||
}
|
||||
|
||||
|
||||
@ -53,6 +53,21 @@ bitmask_init(GWBITMASK *bitmask)
|
||||
spinlock_init(&bitmask->lock);
|
||||
}
|
||||
|
||||
/**
|
||||
* Free a bitmask that is no longer required
|
||||
*
|
||||
* @param bitmask
|
||||
*/
|
||||
void
|
||||
bitmask_free(GWBITMASK *bitmask)
|
||||
{
|
||||
if (bitmask->length)
|
||||
{
|
||||
free(bitmask->bits);
|
||||
bitmask->length = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the bit at the specified bit position in the bitmask.
|
||||
* The bitmask will automatically be extended if the bit is
|
||||
|
||||
@ -44,6 +44,7 @@ typedef struct {
|
||||
} GWBITMASK;
|
||||
|
||||
extern void bitmask_init(GWBITMASK *);
|
||||
extern void bitmask_free(GWBITMASK *);
|
||||
extern void bitmask_set(GWBITMASK *, int);
|
||||
extern void bitmask_clear(GWBITMASK *, int);
|
||||
extern int bitmask_isset(GWBITMASK *, int);
|
||||
|
||||
Reference in New Issue
Block a user