* This function destroys a pull by freeing it completely.
* This should be called only under extreme circumstances.
*/
-void pool_destroy2(struct pool_head *pool);
+void *pool_destroy2(struct pool_head *pool);
/*
* Returns a pointer to type <type> taken from the
void sig_soft_stop(int sig)
{
soft_stop();
+ pool_gc2();
signal(sig, SIG_IGN);
}
void sig_pause(int sig)
{
pause_proxies();
+ pool_gc2();
signal(sig, sig_pause);
}
0 GRACE time
*/
fast_stop();
+ pool_gc2();
/* If we are killed twice, we decide to die*/
signal(sig, SIG_DFL);
}
0 GRACE time
*/
fast_stop();
+ pool_gc2();
/* If we are killed twice, we decide to die*/
signal(sig, SIG_DFL);
}
void deinit(void)
{
- struct proxy *p = proxy;
+ struct proxy *p = proxy, *p0;
struct cap_hdr *h,*h_next;
struct server *s,*s_next;
struct listener *l,*l_next;
pool_destroy2(p->req_cap_pool);
pool_destroy2(p->rsp_cap_pool);
+ p0 = p;
p = p->next;
+ free(p0);
}/* end while(p) */
if (global.chroot) free(global.chroot);
void pool_flush2(struct pool_head *pool)
{
void *temp, *next;
+ if (!pool)
+ return;
+
next = pool->free_list;
while (next) {
temp = next;
/*
* This function destroys a pull by freeing it completely.
* This should be called only under extreme circumstances.
+ * It always returns NULL, easing the clearing of the old pointer.
*/
-void pool_destroy2(struct pool_head *pool)
+void *pool_destroy2(struct pool_head *pool)
{
- pool_flush2(pool);
- FREE(pool);
+ if (pool) {
+ pool_flush2(pool);
+ FREE(pool);
+ }
+ return NULL;
}
/* Dump statistics on pools usage.
#include <common/defaults.h>
#include <common/compat.h>
#include <common/config.h>
+#include <common/memory.h>
#include <common/time.h>
#include <types/global.h>
listeners--;
}
p->state = PR_STSTOPPED;
+ /* try to free more memory */
+ pool_gc2();
}
else {
tv_bound(next, &p->stop_time);