Exemplo n.º 1
0
void HostClearMemory(Host *h) {
    if (h->tag != NULL) {
        DetectTagDataListFree(h->tag);
        h->tag = NULL;
    }
    if (h->threshold != NULL) {
        ThresholdListFree(h->threshold);
        h->threshold = NULL;
    }
    SC_ATOMIC_DESTROY(h->use_cnt);
}
Exemplo n.º 2
0
void HostClearMemory(Host *h) {
    if (h->tag != NULL) {
        DetectTagDataListFree(h->tag);
        h->tag = NULL;
    }
    if (h->threshold != NULL) {
        ThresholdListFree(h->threshold);
        h->threshold = NULL;
    }
    if (h->iprep != NULL) {
        SCFree(h->iprep);
        h->iprep = NULL;
    }
}
Exemplo n.º 3
0
/** \brief Cleanup the host engine
 *
 * Cleanup the host engine from tag and threshold.
 *
 */
void HostCleanup(void)
{
    Host *h;
    uint32_t u;

    if (host_hash != NULL) {
        for (u = 0; u < host_config.hash_size; u++) {
            h = host_hash[u].head;
            HostHashRow *hb = &host_hash[u];
            HRLOCK_LOCK(hb);
            while (h) {
                if ((SC_ATOMIC_GET(h->use_cnt) > 0) && (h->iprep != NULL)) {
                    /* iprep is attached to host only clear tag and threshold */
                    if (h->tag != NULL) {
                        DetectTagDataListFree(h->tag);
                        h->tag = NULL;
                    }
                    if (h->threshold != NULL) {
                        ThresholdListFree(h->threshold);
                        h->threshold = NULL;
                    }
                    h = h->hnext;
                } else {
                    Host *n = h->hnext;
                    /* remove from the hash */
                    if (h->hprev != NULL)
                        h->hprev->hnext = h->hnext;
                    if (h->hnext != NULL)
                        h->hnext->hprev = h->hprev;
                    if (hb->head == h)
                        hb->head = h->hnext;
                    if (hb->tail == h)
                        hb->tail = h->hprev;
                    h->hnext = NULL;
                    h->hprev = NULL;
                    HostClearMemory(h);
                    HostMoveToSpare(h);
                    h = n;
                }
            }
            HRLOCK_UNLOCK(hb);
        }
    }

    return;
}