Ejemplo n.º 1
0
static void destructor(void *arg)
{
	struct chan *chan = arg;

	restund_debug("turn: allocation %p channel 0x%x %J destroyed\n",
		      chan->al, chan->numb, &chan->peer);

	hash_unlink(&chan->he_numb);
	hash_unlink(&chan->he_peer);
}
Ejemplo n.º 2
0
void hdr_destruct2(void *arg) {
    struct http_hdr *hdr = arg;
    hash_unlink(&hdr->he);

    mem_deref((void*)hdr->name.p);
    mem_deref((void*)hdr->val.p);
}
Ejemplo n.º 3
0
Archivo: msg.c Proyecto: Issic47/libre
static void hdr_destructor(void *arg)
{
	struct sip_hdr *hdr = arg;

	list_unlink(&hdr->le);
	hash_unlink(&hdr->he);
}
Ejemplo n.º 4
0
static void destructor(void *arg)
{
	struct sipnot *not = arg;

	tmr_cancel(&not->tmr);

	if (!not->terminated) {

		if (terminate(not, SIPEVENT_DEACTIVATED))
			return;
	}

	hash_unlink(&not->he);
	mem_deref(not->req);
	mem_deref(not->dlg);
	mem_deref(not->auth);
	mem_deref(not->mb);
	mem_deref(not->event);
	mem_deref(not->id);
	mem_deref(not->cuser);
	mem_deref(not->hdrs);
	mem_deref(not->ctype);
	mem_deref(not->sock);
	mem_deref(not->sip);
}
Ejemplo n.º 5
0
static void conn_close(struct sip_conn *conn, int err)
{
	struct le *le;

	conn->sc = mem_deref(conn->sc);
	conn->tc = mem_deref(conn->tc);
	tmr_cancel(&conn->tmr_ka);
	tmr_cancel(&conn->tmr);
	hash_unlink(&conn->he);

	le = list_head(&conn->ql);

	while (le) {

		struct sip_connqent *qent = le->data;
		le = le->next;

		if (qent->qentp) {
			*qent->qentp = NULL;
			qent->qentp = NULL;
		}

		qent->transph(err, qent->arg);
		list_unlink(&qent->le);
		mem_deref(qent);
	}

	sip_keepalive_signal(&conn->kal, err);
}
Ejemplo n.º 6
0
static void destructor(void *arg)
{
	struct dname *dn = arg;

	hash_unlink(&dn->he);
	mem_deref(dn->name);
}
Ejemplo n.º 7
0
static void destructor(void *arg)
{
	struct perm *perm = arg;

	tmr_cancel(&perm->tmr);
	mem_deref(perm->ct);
	hash_unlink(&perm->he);
}
Ejemplo n.º 8
0
static void destructor(void *arg)
{
	struct contact *c = arg;

	hash_unlink(&c->he);
	list_unlink(&c->le);
	mem_deref(c->buf);
}
Ejemplo n.º 9
0
static void udpconn_close(struct sip_udpconn *uc, int err)
{
	sip_keepalive_signal(&uc->kal, err);
	hash_unlink(&uc->he);
	tmr_cancel(&uc->tmr_ka);
	uc->ct = mem_deref(uc->ct);
	uc->us = mem_deref(uc->us);
	uc->stun = mem_deref(uc->stun);
}
Ejemplo n.º 10
0
static void tcpconn_destructor(void *arg)
{
	struct tcpconn *tc = arg;

	hash_unlink(&tc->le);
	tmr_cancel(&tc->tmr);
	mem_deref(tc->conn);
	mem_deref(tc->mb);
}
Ejemplo n.º 11
0
static void query_abort(struct dns_query *q)
{
	if (q->tc) {
		list_unlink(&q->le_tc);
		q->tc = mem_deref(q->tc);
	}

	tmr_cancel(&q->tmr);
	hash_unlink(&q->le);
}
Ejemplo n.º 12
0
static void destructor(void *arg)
{
	struct sip_udpconn *uc = arg;

	list_flush(&uc->kal);
	hash_unlink(&uc->he);
	tmr_cancel(&uc->tmr_ka);
	mem_deref(uc->ct);
	mem_deref(uc->us);
	mem_deref(uc->stun);
}
Ejemplo n.º 13
0
static void conn_destructor(void *arg)
{
	struct tls_conn *tc = arg;

	hash_unlink(&tc->he);
	tmr_cancel(&tc->tmr);

	if (tc->ssl) {
		(void)SSL_shutdown(tc->ssl);
		SSL_free(tc->ssl);
	}
}
Ejemplo n.º 14
0
static void conn_destructor(void *arg)
{
	struct sip_conn *conn = arg;

	tmr_cancel(&conn->tmr_ka);
	tmr_cancel(&conn->tmr);
	list_flush(&conn->kal);
	list_flush(&conn->ql);
	hash_unlink(&conn->he);
	mem_deref(conn->sc);
	mem_deref(conn->tc);
	mem_deref(conn->mb);
}
Ejemplo n.º 15
0
static void destructor(void *arg)
{
	struct sip_ctrans *ct = arg;

	hash_unlink(&ct->he);
	tmr_cancel(&ct->tmr);
	tmr_cancel(&ct->tmre);
	mem_deref(ct->met);
	mem_deref(ct->branch);
	mem_deref(ct->qent);
	mem_deref(ct->req);
	mem_deref(ct->mb);
	mem_deref(ct->mb_ack);
}
Ejemplo n.º 16
0
main(int argc, char **argv)
{
    char c;
    extern char *optarg;
    malloc_options = "A";
    a = 0;
    while ((c = getopt(argc, argv, "f:i:M:l:m:r:N")) != -1) {
        switch (c) {
        case 'N':
            mem_pools_on = 0;
            break;
        case 'r':
            run_stats = atoi(optarg);
            break;
        case 'f':
            fn = xstrdup(optarg);
            fp = fopen(fn, "r");
            break;
        case 'i':
            initsiz = atoi(optarg);
            break;
        case 'l':
            mem_max_size = atoi(optarg) * 1024 * 1024;
            break;
        case 'M':
            maxsiz = atoi(optarg);
            break;
        case 'm':
            minchunk = atoi(optarg);
            break;
        default:
            fprintf(stderr,
                    "Usage: %s -f file -M maxsiz -i initsiz -m minchunk", argv[0]);
            exit(1);
        }

    }
    if (!fp) {
        fprintf(stderr,
                "%s pummels %s\n%s . o O ( You't supply a valid tracefile.)\n",
                argv[0], getenv("USER"), argv[0]);
        exit(1);
    }
#ifdef WITH_LIB
    sizeToPoolInit();
#endif
    mem_table = hash_create(ptrcmp, 229, hash4);    /* small hash table */
    init_stats();
    while (fgets(mbuf, 256, fp) != NULL) {
        if (run_stats > 0 && (++a) % run_stats == 0)
            print_stats();
        p = NULL;
        switch (mbuf[0]) {
        case 'm':       /* malloc */
            p = strtok(&mbuf[2], ":");
            if (!p)
                badformat();
            size = atoi(p);
            p = strtok(NULL, "\n");
            if (!p)
                badformat();
            mi = malloc(sizeof(memitem));
            strcpy(mi->orig_ptr, p);
            mi->size = size;
            size2id(size, mi);
            mi->my_ptr = xmemAlloc(mi);     /* (void *)xmalloc(size); */
            assert(mi->my_ptr);
            my_hash_insert(mem_table, mi->orig_ptr, mi);
            mstat.mallocs++;
            break;
        case 'c':       /* calloc */
            p = strtok(&mbuf[2], ":");
            if (!p)
                badformat();
            amt = atoi(p);
            p = strtok(NULL, ":");
            if (!p)
                badformat();
            size = atoi(p);
            p = strtok(NULL, "\n");
            if (!p)
                badformat();
            mi = malloc(sizeof(memitem));
            strcpy(mi->orig_ptr, p);
            size2id(size, mi);
            mi->size = amt * size;
            mi->my_ptr = xmemAlloc(mi);     /*(void *)xmalloc(amt*size); */
            assert(mi->my_ptr);
            my_hash_insert(mem_table, mi->orig_ptr, mi);
            mstat.callocs++;
            break;
        case 'r':
            p = strtok(&mbuf[2], ":");
            if (!p)
                badformat();
            strcpy(abuf, p);
            p = strtok(NULL, ":");
            if (!p)
                badformat();
            mem_entry = hash_lookup(mem_table, p);
            if (mem_entry == NULL) {
                fprintf(stderr, "invalid realloc (%s)!\n", p);
                break;
            }
            mi = (memitem *) (mem_entry->item);
            assert(mi->pool);
            assert(mi->my_ptr);
            xmemFree(mi);   /* xfree(mi->my_ptr); */
            size2id(atoi(p), mi);   /* we don't need it here I guess? */
            strcpy(mi->orig_ptr, abuf);
            p = strtok(NULL, "\n");
            if (!p)
                badformat();
            mi->my_ptr = xmemAlloc(mi);     /* (char *)xmalloc(atoi(p)); */
            assert(mi->my_ptr);
            mstat.reallocs++;
            break;
        case 'f':
            p = strtok(&mbuf[2], "\n");
            mem_entry = hash_lookup(mem_table, p);
            if (mem_entry == NULL) {
                if (p[0] != '0')
                    fprintf(stderr, "invalid free (%s) at line %d!\n", p, a);
                break;
            }
            mi = (memitem *) (mem_entry->item);
            assert(mi->pool);
            assert(mi->my_ptr);
            xmemFree(mi);   /* xfree(mi->my_ptr); */
            hash_unlink(mem_table, mem_entry, 1);
            free(mi);
            mstat.frees++;
            break;
        default:
            fprintf(stderr, "%s pummels %s.bad.format\n", argv[0], fn);
            exit(1);
        }

    }
    fclose(fp);
    print_stats();
}
Ejemplo n.º 17
0
void hdr_destruct(void *arg) {
    struct http_hdr *hdr = arg;
    hash_unlink(&hdr->he);

}