make ks_pool_free appear take double pointer
This commit is contained in:
parent
73e4c22255
commit
d2f04e2133
|
@ -286,7 +286,7 @@ KS_DECLARE(void) ks_dht_destroy(ks_dht_t **dht)
|
|||
* Cleanup the array of endpoint pointers if it is allocated.
|
||||
*/
|
||||
if (d->endpoints) {
|
||||
ks_pool_free(d->pool, d->endpoints);
|
||||
ks_pool_free(d->pool, &d->endpoints);
|
||||
d->endpoints = NULL;
|
||||
}
|
||||
|
||||
|
@ -294,7 +294,7 @@ KS_DECLARE(void) ks_dht_destroy(ks_dht_t **dht)
|
|||
* Cleanup the array of endpoint polling data if it is allocated.
|
||||
*/
|
||||
if (d->endpoints_poll) {
|
||||
ks_pool_free(d->pool, d->endpoints_poll);
|
||||
ks_pool_free(d->pool, &d->endpoints_poll);
|
||||
d->endpoints_poll = NULL;
|
||||
}
|
||||
|
||||
|
@ -338,7 +338,7 @@ KS_DECLARE(void) ks_dht_destroy(ks_dht_t **dht)
|
|||
/**
|
||||
* Free the dht instance from the pool, after this the dht instance memory is invalid.
|
||||
*/
|
||||
ks_pool_free(d->pool, d);
|
||||
ks_pool_free(d->pool, &d);
|
||||
|
||||
/**
|
||||
* At this point dht instance is invalidated so NULL the pointer.
|
||||
|
|
|
@ -214,7 +214,7 @@ KS_DECLARE(void) ks_dhtrt_deinitroute(ks_dhtrt_routetable_t **table)
|
|||
|
||||
ks_pool_t *pool = (*table)->pool;
|
||||
|
||||
ks_pool_free(pool, *table);
|
||||
ks_pool_free(pool, &(*table));
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -259,7 +259,7 @@ KS_DECLARE(ks_status_t) ks_dhtrt_create_node( ks_dhtrt_routetable_t *table,
|
|||
|
||||
if (( ks_addr_set(&tnode->addr, ip, port, tnode->family) != KS_STATUS_SUCCESS) ||
|
||||
( ks_rwl_create(&tnode->reflock, table->pool) != KS_STATUS_SUCCESS)) {
|
||||
ks_pool_free(table->pool, tnode);
|
||||
ks_pool_free(table->pool, &tnode);
|
||||
ks_rwl_read_unlock(internal->lock);
|
||||
return KS_STATUS_FAIL;
|
||||
}
|
||||
|
@ -308,7 +308,7 @@ KS_DECLARE(ks_status_t) ks_dhtrt_delete_node(ks_dhtrt_routetable_t *table, ks_dh
|
|||
|
||||
if (ks_rwl_try_write_lock(node->reflock) == KS_STATUS_SUCCESS) { /* grab exclusive lock on node */
|
||||
ks_rwl_destroy(&(node->reflock));
|
||||
ks_pool_free(table->pool, node);
|
||||
ks_pool_free(table->pool, &node);
|
||||
}
|
||||
else {
|
||||
ks_dhtrt_queue_node_fordelete(table, node);
|
||||
|
@ -718,7 +718,7 @@ uint8_t ks_dhtrt_findclosest_locked_nodes(ks_dhtrt_routetable_t *table, ks_dhtrt
|
|||
while (tofree) {
|
||||
ks_dhtrt_sortedxors_t *x = tofree->next;
|
||||
|
||||
ks_pool_free(table->pool, tofree);
|
||||
ks_pool_free(table->pool, &tofree);
|
||||
tofree = x;
|
||||
}
|
||||
|
||||
|
@ -859,10 +859,10 @@ void ks_dhtrt_process_deleted(ks_dhtrt_routetable_t *table)
|
|||
|
||||
if (ks_rwl_try_write_lock(node->reflock) == KS_STATUS_SUCCESS) {
|
||||
ks_rwl_destroy(&(node->reflock));
|
||||
ks_pool_free(table->pool, node);
|
||||
ks_pool_free(table->pool, &node);
|
||||
temp = deleted;
|
||||
deleted = deleted->next;
|
||||
ks_pool_free(table->pool, temp);
|
||||
ks_pool_free(table->pool, &temp);
|
||||
--internal->deleted_count;
|
||||
if (prev != NULL) {
|
||||
prev->next = deleted;
|
||||
|
|
|
@ -46,7 +46,7 @@ KS_DECLARE(void) ks_dht_datagram_destroy(ks_dht_datagram_t **datagram)
|
|||
|
||||
dg = *datagram;
|
||||
|
||||
ks_pool_free(dg->pool, dg);
|
||||
ks_pool_free(dg->pool, &dg);
|
||||
|
||||
*datagram = NULL;
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ KS_DECLARE(void) ks_dht_endpoint_destroy(ks_dht_endpoint_t **endpoint)
|
|||
ep = *endpoint;
|
||||
|
||||
if (ep->sock != KS_SOCK_INVALID) ks_socket_close(&ep->sock);
|
||||
ks_pool_free(ep->pool, ep);
|
||||
ks_pool_free(ep->pool, &ep);
|
||||
|
||||
*endpoint = NULL;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ KS_DECLARE(void) ks_dht_message_destroy(ks_dht_message_t **message)
|
|||
ben_free(m->data);
|
||||
m->data = NULL;
|
||||
}
|
||||
ks_pool_free(m->pool, *message);
|
||||
ks_pool_free(m->pool, &(*message));
|
||||
|
||||
*message = NULL;
|
||||
}
|
||||
|
|
|
@ -53,12 +53,12 @@ KS_DECLARE(void) ks_dht_search_destroy(ks_dht_search_t **search)
|
|||
ks_hash_destroy(&s->pending);
|
||||
}
|
||||
if (s->callbacks) {
|
||||
ks_pool_free(s->pool, s->callbacks);
|
||||
ks_pool_free(s->pool, &s->callbacks);
|
||||
s->callbacks = NULL;
|
||||
}
|
||||
if (s->mutex) ks_mutex_destroy(&s->mutex);
|
||||
|
||||
ks_pool_free(s->pool, s);
|
||||
ks_pool_free(s->pool, &s);
|
||||
|
||||
*search = NULL;
|
||||
}
|
||||
|
@ -115,7 +115,7 @@ KS_DECLARE(void) ks_dht_search_pending_destroy(ks_dht_search_pending_t **pending
|
|||
|
||||
p = *pending;
|
||||
|
||||
ks_pool_free(p->pool, p);
|
||||
ks_pool_free(p->pool, &p);
|
||||
|
||||
*pending = NULL;
|
||||
}
|
||||
|
|
|
@ -105,7 +105,7 @@ KS_DECLARE(void) ks_dht_storageitem_destroy(ks_dht_storageitem_t **item)
|
|||
ben_free(si->v);
|
||||
si->v = NULL;
|
||||
}
|
||||
ks_pool_free(si->pool, si);
|
||||
ks_pool_free(si->pool, &si);
|
||||
|
||||
*item = NULL;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ KS_DECLARE(void) ks_dht_transaction_destroy(ks_dht_transaction_t **transaction)
|
|||
|
||||
t = *transaction;
|
||||
|
||||
ks_pool_free(t->pool, t);
|
||||
ks_pool_free(t->pool, &t);
|
||||
|
||||
*transaction = NULL;
|
||||
}
|
||||
|
|
|
@ -291,7 +291,7 @@ KS_DECLARE(void *) ks_pool_calloc_ex(ks_pool_t *mp_p, const unsigned long ele_n,
|
|||
*
|
||||
*/
|
||||
|
||||
KS_DECLARE(ks_status_t) ks_pool_free(ks_pool_t *mp_p, void *addr);
|
||||
KS_DECLARE(ks_status_t) ks_pool_free_ex(ks_pool_t *mp_p, void **addrP);
|
||||
|
||||
/*
|
||||
* void *ks_pool_resize
|
||||
|
@ -453,7 +453,7 @@ KS_DECLARE(const char *) ks_pool_strerror(const ks_status_t error);
|
|||
|
||||
KS_DECLARE(ks_status_t) ks_pool_set_cleanup(ks_pool_t *mp_p, void *ptr, void *arg, int type, ks_pool_cleanup_fn_t fn);
|
||||
|
||||
#define ks_pool_safe_free(_p, _a) ks_pool_free(_p, _a); (_a) = NULL
|
||||
#define ks_pool_free(_p, _x) ks_pool_free_ex(_p, (void **)_x)
|
||||
|
||||
/*<<<<<<<<<< This is end of the auto-generated output from fillproto. */
|
||||
|
||||
|
|
|
@ -943,7 +943,7 @@ static int expire_buckets(dht_handle_t *h, struct bucket *b)
|
|||
b->nodes = n->next;
|
||||
b->count--;
|
||||
changed = 1;
|
||||
ks_pool_free(h->pool, n);
|
||||
ks_pool_free(h->pool, &n);
|
||||
}
|
||||
|
||||
p = b->nodes;
|
||||
|
@ -953,7 +953,7 @@ static int expire_buckets(dht_handle_t *h, struct bucket *b)
|
|||
p->next = n->next;
|
||||
b->count--;
|
||||
changed = 1;
|
||||
ks_pool_free(h->pool, n);
|
||||
ks_pool_free(h->pool, &n);
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
|
@ -1073,7 +1073,7 @@ static void expire_searches(dht_handle_t *h)
|
|||
} else {
|
||||
h->searches = next;
|
||||
}
|
||||
ks_pool_free(h->pool, sr);
|
||||
ks_pool_free(h->pool, &sr);
|
||||
h->numsearches--;
|
||||
} else {
|
||||
previous = sr;
|
||||
|
@ -1425,11 +1425,11 @@ static int expire_storage(dht_handle_t *h)
|
|||
free(st->peers);
|
||||
if (previous) {
|
||||
previous->next = st->next;
|
||||
ks_pool_free(h->pool, st);
|
||||
ks_pool_free(h->pool, &st);
|
||||
st = previous->next;
|
||||
} else {
|
||||
h->storage = st->next;
|
||||
ks_pool_free(h->pool, st);
|
||||
ks_pool_free(h->pool, &st);
|
||||
st = h->storage;
|
||||
}
|
||||
|
||||
|
@ -1670,7 +1670,7 @@ static void ks_dht_store_entry_destroy(struct ks_dht_store_entry_s **old_entry)
|
|||
entry->body = NULL;
|
||||
}
|
||||
|
||||
ks_pool_free(pool, entry);
|
||||
ks_pool_free(pool, &entry);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1848,7 +1848,7 @@ static void ks_dht_store_destroy(struct ks_dht_store_s **old_store)
|
|||
|
||||
ks_hash_destroy(&store->hash);
|
||||
|
||||
ks_pool_free(pool, store);
|
||||
ks_pool_free(pool, &store);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1954,7 +1954,7 @@ static void clear_all_ip(dht_handle_t *h)
|
|||
ipt = (ks_ip_t *) val;
|
||||
|
||||
ks_socket_close(&ipt->sock);
|
||||
ks_pool_free(h->pool, ipt);
|
||||
ks_pool_free(h->pool, &ipt);
|
||||
|
||||
if (ipt->addr.family == AF_INET) {
|
||||
h->ip4s--;
|
||||
|
@ -2008,14 +2008,14 @@ static ks_ip_t *add_ip(dht_handle_t *h, const char *ip, int port, int family)
|
|||
|
||||
if ((ipt->sock = socket(family, SOCK_DGRAM, IPPROTO_UDP)) == KS_SOCK_INVALID) {
|
||||
ks_log(KS_LOG_ERROR, "Socket Error\n");
|
||||
ks_pool_free(h->pool, ipt);
|
||||
ks_pool_free(h->pool, &ipt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (ks_addr_bind(ipt->sock, &ipt->addr) != KS_STATUS_SUCCESS) {
|
||||
ks_log(KS_LOG_ERROR, "Error Adding bind ip: %s port: %d sock: %d (%s)\n", ip, port, ipt->sock, strerror(errno));
|
||||
ks_socket_close(&ipt->sock);
|
||||
ks_pool_free(h->pool, ipt);
|
||||
ks_pool_free(h->pool, &ipt);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -2168,9 +2168,9 @@ KS_DECLARE(ks_status_t) ks_dht_init(dht_handle_t **handle, ks_dht_af_flag_t af_f
|
|||
return KS_STATUS_SUCCESS;
|
||||
|
||||
fail:
|
||||
ks_pool_free(h->pool, h->buckets);
|
||||
ks_pool_free(h->pool, &h->buckets);
|
||||
h->buckets = NULL;
|
||||
ks_pool_free(h->pool, h->buckets6);
|
||||
ks_pool_free(h->pool, &h->buckets6);
|
||||
h->buckets6 = NULL;
|
||||
return KS_STATUS_FAIL;
|
||||
}
|
||||
|
@ -2193,9 +2193,9 @@ KS_DECLARE(int) dht_uninit(dht_handle_t **handle)
|
|||
while (b->nodes) {
|
||||
struct node *n = b->nodes;
|
||||
b->nodes = n->next;
|
||||
ks_pool_free(h->pool, n);
|
||||
ks_pool_free(h->pool, &n);
|
||||
}
|
||||
ks_pool_free(h->pool, b);
|
||||
ks_pool_free(h->pool, &b);
|
||||
}
|
||||
|
||||
while (h->buckets6) {
|
||||
|
@ -2204,28 +2204,28 @@ KS_DECLARE(int) dht_uninit(dht_handle_t **handle)
|
|||
while (b->nodes) {
|
||||
struct node *n = b->nodes;
|
||||
b->nodes = n->next;
|
||||
ks_pool_free(h->pool, n);
|
||||
ks_pool_free(h->pool, &n);
|
||||
}
|
||||
ks_pool_free(h->pool, b);
|
||||
ks_pool_free(h->pool, &b);
|
||||
}
|
||||
|
||||
while (h->storage) {
|
||||
struct storage *st = h->storage;
|
||||
h->storage = h->storage->next;
|
||||
ks_pool_free(h->pool, st->peers);
|
||||
ks_pool_free(h->pool, st);
|
||||
ks_pool_free(h->pool, &st->peers);
|
||||
ks_pool_free(h->pool, &st);
|
||||
}
|
||||
|
||||
while (h->searches) {
|
||||
struct search *sr = h->searches;
|
||||
h->searches = h->searches->next;
|
||||
ks_pool_free(h->pool, sr);
|
||||
ks_pool_free(h->pool, &sr);
|
||||
}
|
||||
|
||||
ks_dht_store_destroy(&h->store);
|
||||
pool = h->pool;
|
||||
h->pool = NULL;
|
||||
ks_pool_free(pool, h);
|
||||
ks_pool_free(pool, &h);
|
||||
ks_pool_close(&pool);
|
||||
|
||||
return 1;
|
||||
|
|
|
@ -293,7 +293,7 @@ ks_hash_expand(ks_hash_t *h)
|
|||
newtable[index] = e;
|
||||
}
|
||||
}
|
||||
ks_pool_safe_free(h->pool, h->table);
|
||||
ks_pool_free(h->pool, &h->table);
|
||||
h->table = newtable;
|
||||
}
|
||||
/* Plan B: realloc instead */
|
||||
|
@ -357,10 +357,10 @@ static void * _ks_hash_remove(ks_hash_t *h, void *k, unsigned int hashvalue, uns
|
|||
h->entrycount--;
|
||||
v = e->v;
|
||||
if (e->flags & KS_HASH_FLAG_FREE_KEY) {
|
||||
ks_pool_free(h->pool, e->k);
|
||||
ks_pool_free(h->pool, &e->k);
|
||||
}
|
||||
if (e->flags & KS_HASH_FLAG_FREE_VALUE) {
|
||||
ks_pool_safe_free(h->pool, e->v);
|
||||
ks_pool_free(h->pool, &e->v);
|
||||
v = NULL;
|
||||
} else if (e->destructor) {
|
||||
e->destructor(e->v);
|
||||
|
@ -369,7 +369,7 @@ static void * _ks_hash_remove(ks_hash_t *h, void *k, unsigned int hashvalue, uns
|
|||
h->destructor(e->v);
|
||||
v = e->v = NULL;
|
||||
}
|
||||
ks_pool_safe_free(h->pool, e);
|
||||
ks_pool_free(h->pool, &e);
|
||||
return v;
|
||||
}
|
||||
pE = &(e->next);
|
||||
|
@ -538,11 +538,11 @@ ks_hash_destroy(ks_hash_t **h)
|
|||
f = e; e = e->next;
|
||||
|
||||
if (f->flags & KS_HASH_FLAG_FREE_KEY) {
|
||||
ks_pool_free((*h)->pool, f->k);
|
||||
ks_pool_free((*h)->pool, &f->k);
|
||||
}
|
||||
|
||||
if (f->flags & KS_HASH_FLAG_FREE_VALUE) {
|
||||
ks_pool_safe_free((*h)->pool, f->v);
|
||||
ks_pool_free((*h)->pool, &f->v);
|
||||
} else if (f->destructor) {
|
||||
f->destructor(f->v);
|
||||
f->v = NULL;
|
||||
|
@ -550,18 +550,18 @@ ks_hash_destroy(ks_hash_t **h)
|
|||
(*h)->destructor(f->v);
|
||||
f->v = NULL;
|
||||
}
|
||||
ks_pool_safe_free((*h)->pool, f);
|
||||
ks_pool_free((*h)->pool, &f);
|
||||
}
|
||||
}
|
||||
|
||||
pool = (*h)->pool;
|
||||
ks_pool_safe_free(pool, (*h)->table);
|
||||
ks_pool_free(pool, &(*h)->table);
|
||||
ks_hash_write_unlock(*h);
|
||||
if ((*h)->rwl) ks_pool_free(pool, (*h)->rwl);
|
||||
if ((*h)->rwl) ks_pool_free(pool, &(*h)->rwl);
|
||||
if ((*h)->mutex) {
|
||||
ks_pool_free(pool, (*h)->mutex);
|
||||
ks_pool_free(pool, &(*h)->mutex);
|
||||
}
|
||||
ks_pool_free(pool, *h);
|
||||
ks_pool_free(pool, &(*h));
|
||||
pool = NULL;
|
||||
*h = NULL;
|
||||
|
||||
|
@ -580,7 +580,7 @@ KS_DECLARE(void) ks_hash_last(ks_hash_iterator_t **iP)
|
|||
ks_rwl_read_unlock(i->h->rwl);
|
||||
}
|
||||
|
||||
ks_pool_free(i->h->pool, i);
|
||||
ks_pool_free(i->h->pool, &i);
|
||||
|
||||
*iP = NULL;
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ KS_DECLARE(ks_status_t) ks_mutex_destroy(ks_mutex_t **mutexP)
|
|||
#endif
|
||||
free(mutex);
|
||||
} else {
|
||||
ks_pool_free(mutex->pool, (void *)mutex);
|
||||
ks_pool_free(mutex->pool, &mutex);
|
||||
}
|
||||
|
||||
return KS_STATUS_SUCCESS;
|
||||
|
@ -422,7 +422,7 @@ KS_DECLARE(ks_status_t) ks_cond_destroy(ks_cond_t **cond)
|
|||
|
||||
*cond = NULL;
|
||||
|
||||
return ks_pool_free(condp->pool, condp);
|
||||
return ks_pool_free(condp->pool, &condp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -655,7 +655,7 @@ KS_DECLARE(ks_status_t) ks_rwl_destroy(ks_rwl_t **rwlock)
|
|||
|
||||
*rwlock = NULL;
|
||||
|
||||
return ks_pool_free(rwlockp->pool, rwlockp);
|
||||
return ks_pool_free(rwlockp->pool, &rwlockp);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1616,12 +1616,17 @@ KS_DECLARE(void *) ks_pool_calloc(ks_pool_t *mp_p, const unsigned long ele_n, co
|
|||
* mp_p <-> Pointer to the memory pool.
|
||||
*
|
||||
*
|
||||
* addr <-> Address to free.
|
||||
* addr <-> pointer to pointer of Address to free.
|
||||
*
|
||||
*/
|
||||
KS_DECLARE(ks_status_t) ks_pool_free(ks_pool_t *mp_p, void *addr)
|
||||
KS_DECLARE(ks_status_t) ks_pool_free_ex(ks_pool_t *mp_p, void **addrP)
|
||||
{
|
||||
ks_status_t r;
|
||||
void *addr;
|
||||
|
||||
ks_assert(addrP);
|
||||
|
||||
addr = *addrP;
|
||||
|
||||
ks_assert(mp_p);
|
||||
ks_assert(addr);
|
||||
|
@ -1649,6 +1654,10 @@ KS_DECLARE(ks_status_t) ks_pool_free(ks_pool_t *mp_p, void *addr)
|
|||
|
||||
ks_mutex_unlock(mp_p->mutex);
|
||||
|
||||
if (r == KS_STATUS_SUCCESS) {
|
||||
*addrP = NULL;
|
||||
}
|
||||
|
||||
return r;
|
||||
|
||||
}
|
||||
|
|
|
@ -73,14 +73,14 @@ static void ks_q_cleanup(ks_pool_t *mpool, void *ptr, void *arg, int type, ks_po
|
|||
while(np) {
|
||||
fp = np;
|
||||
np = np->next;
|
||||
ks_pool_free(q->pool, fp);
|
||||
ks_pool_free(q->pool, &fp);
|
||||
}
|
||||
|
||||
np = q->empty;
|
||||
while(np) {
|
||||
fp = np;
|
||||
np = np->next;
|
||||
ks_pool_free(q->pool, fp);
|
||||
ks_pool_free(q->pool, &fp);
|
||||
}
|
||||
break;
|
||||
case KS_MPCL_DESTROY:
|
||||
|
@ -167,7 +167,7 @@ KS_DECLARE(ks_status_t) ks_q_destroy(ks_q_t **qP)
|
|||
ks_q_term(q);
|
||||
|
||||
pool = q->pool;
|
||||
ks_pool_free(pool, q);
|
||||
ks_pool_free(pool, &q);
|
||||
pool = NULL;
|
||||
|
||||
return KS_STATUS_SUCCESS;
|
||||
|
|
|
@ -261,7 +261,7 @@ KS_DECLARE(ks_status_t) ks_thread_create_ex(ks_thread_t **rthread, ks_thread_fun
|
|||
if (thread) {
|
||||
thread->running = 0;
|
||||
if (pool) {
|
||||
ks_pool_safe_free(pool, thread);
|
||||
ks_pool_free(pool, &thread);
|
||||
}
|
||||
}
|
||||
done:
|
||||
|
|
|
@ -170,7 +170,7 @@ static void *worker_thread(ks_thread_t *thread, void *data)
|
|||
idle_sec = 0;
|
||||
job->func(thread, job->data);
|
||||
|
||||
ks_pool_free(tp->pool, job);
|
||||
ks_pool_free(tp->pool, &job);
|
||||
|
||||
ks_mutex_lock(tp->mutex);
|
||||
tp->busy_thread_count--;
|
||||
|
|
|
@ -752,7 +752,7 @@ KS_DECLARE(void) kws_destroy(kws_t **kwsP)
|
|||
kws->down = 2;
|
||||
|
||||
if (kws->write_buffer) {
|
||||
ks_pool_free(kws->pool, kws->write_buffer);
|
||||
ks_pool_free(kws->pool, &kws->write_buffer);
|
||||
kws->write_buffer = NULL;
|
||||
kws->write_buffer_len = 0;
|
||||
}
|
||||
|
@ -767,12 +767,12 @@ KS_DECLARE(void) kws_destroy(kws_t **kwsP)
|
|||
kws->ssl = NULL;
|
||||
}
|
||||
|
||||
if (kws->buffer) ks_pool_free(kws->pool, kws->buffer);
|
||||
if (kws->bbuffer) ks_pool_free(kws->pool, kws->bbuffer);
|
||||
if (kws->buffer) ks_pool_free(kws->pool, &kws->buffer);
|
||||
if (kws->bbuffer) ks_pool_free(kws->pool, &kws->bbuffer);
|
||||
|
||||
kws->buffer = kws->bbuffer = NULL;
|
||||
|
||||
ks_pool_free(kws->pool, kws);
|
||||
ks_pool_free(kws->pool, &kws);
|
||||
kws = NULL;
|
||||
}
|
||||
|
||||
|
@ -786,7 +786,7 @@ KS_DECLARE(ks_ssize_t) kws_close(kws_t *kws, int16_t reason)
|
|||
kws->down = 1;
|
||||
|
||||
if (kws->uri) {
|
||||
ks_pool_free(kws->pool, kws->uri);
|
||||
ks_pool_free(kws->pool, &kws->uri);
|
||||
kws->uri = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ int main(int argc, char **argv)
|
|||
|
||||
printf("FREE:\n");
|
||||
|
||||
status = ks_pool_safe_free(pool, str);
|
||||
status = ks_pool_free(pool, &str);
|
||||
if (status != KS_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "FREE ERR: [%s]\n", ks_pool_strerror(err));
|
||||
exit(255);
|
||||
|
@ -122,7 +122,7 @@ int main(int argc, char **argv)
|
|||
|
||||
printf("FREE OBJ:\n");
|
||||
|
||||
status = ks_pool_safe_free(pool, foo);
|
||||
status = ks_pool_free(pool, &foo);
|
||||
ok(status == KS_STATUS_SUCCESS);
|
||||
if (status != KS_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "FREE OBJ ERR: [%s]\n", ks_pool_strerror(status));
|
||||
|
@ -181,7 +181,7 @@ int main(int argc, char **argv)
|
|||
|
||||
printf("FREE 2:\n");
|
||||
|
||||
status = ks_pool_free(pool, str);
|
||||
status = ks_pool_free(pool, &str);
|
||||
ok(status == KS_STATUS_SUCCESS);
|
||||
if (status != KS_STATUS_SUCCESS) {
|
||||
fprintf(stderr, "FREE2 ERR: [%s]\n", ks_pool_strerror(status));
|
||||
|
|
|
@ -10,7 +10,7 @@ static void *test1_thread(ks_thread_t *thread, void *data)
|
|||
while(ks_q_pop(q, &pop) == KS_STATUS_SUCCESS) {
|
||||
//int *i = (int *)pop;
|
||||
//printf("POP %d\n", *i);
|
||||
ks_pool_free(thread->pool, pop);
|
||||
ks_pool_free(thread->pool, &pop);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
@ -19,7 +19,7 @@ static void *test1_thread(ks_thread_t *thread, void *data)
|
|||
static void do_flush(ks_q_t *q, void *ptr, void *flush_data)
|
||||
{
|
||||
ks_pool_t *pool = (ks_pool_t *)flush_data;
|
||||
ks_pool_free(pool, ptr);
|
||||
ks_pool_free(pool, &ptr);
|
||||
|
||||
}
|
||||
|
||||
|
@ -104,7 +104,7 @@ static void *test2_thread(ks_thread_t *thread, void *data)
|
|||
//int *i = (int *)pop;
|
||||
//printf("%p POP %d\n", (void *)pthread_self(), *i);
|
||||
popped++;
|
||||
ks_pool_free(thread->pool, pop);
|
||||
ks_pool_free(thread->pool, &pop);
|
||||
} else if (status == KS_STATUS_INACTIVE) {
|
||||
break;
|
||||
} else if (t2->try && ks_q_size(t2->q)) {
|
||||
|
|
|
@ -185,7 +185,7 @@ static void *thread_test_function_atatched(ks_thread_t *thread, void *data)
|
|||
|
||||
for (i = 0; i < LOOP_COUNT; i++) {
|
||||
if (last_mem) {
|
||||
ks_pool_safe_free(thread->pool, last_mem);
|
||||
ks_pool_free(thread->pool, &last_mem);
|
||||
}
|
||||
mem = ks_pool_alloc(thread->pool, 1024);
|
||||
last_mem = mem;
|
||||
|
@ -246,7 +246,7 @@ static void check_thread_priority(void)
|
|||
ok( ks_thread_priority(thread_p) == KS_PRI_IMPORTANT );
|
||||
end_todo;
|
||||
|
||||
ks_pool_free(pool, thread_p);
|
||||
ks_pool_free(pool, &thread_p);
|
||||
}
|
||||
|
||||
static void join_threads(void)
|
||||
|
|
Loading…
Reference in New Issue