diff --git a/include/haproxy/proxy.h b/include/haproxy/proxy.h index 1666b00ba..c6c41260c 100644 --- a/include/haproxy/proxy.h +++ b/include/haproxy/proxy.h @@ -51,6 +51,7 @@ int resume_proxy(struct proxy *p); void stop_proxy(struct proxy *p); int stream_set_backend(struct stream *s, struct proxy *be); +void deinit_proxy(struct proxy *p); void free_proxy(struct proxy *p); const char *proxy_cap_str(int cap); const char *proxy_mode_str(int mode); diff --git a/src/proxy.c b/src/proxy.c index f1f2a3f03..cd7caf073 100644 --- a/src/proxy.c +++ b/src/proxy.c @@ -284,7 +284,10 @@ static inline void proxy_free_common(struct proxy *px) px->uri_auth = NULL; } -void free_proxy(struct proxy *p) +/* deinit all
proxy members, but doesn't touch to the parent pointer + * itself + */ +void deinit_proxy(struct proxy *p) { struct server *s; struct cap_hdr *h,*h_next; @@ -424,6 +427,12 @@ void free_proxy(struct proxy *p) HA_RWLOCK_DESTROY(&p->lock); proxy_unref_defaults(p); +} + +/* deinit and free
proxy */ +void free_proxy(struct proxy *p) +{ + deinit_proxy(p); ha_free(&p); }