diff --git a/daemon/control_ng.c b/daemon/control_ng.c index 3673c8363..722d4b627 100644 --- a/daemon/control_ng.c +++ b/daemon/control_ng.c @@ -399,7 +399,7 @@ send_only: out: ng_buffer_release(ngbuf); release_closed_sockets(); - log_info_pop(); + log_info_pop_until(&callid); return funcret; } diff --git a/daemon/log_funcs.h b/daemon/log_funcs.h index 3d8992e28..31d91b54c 100644 --- a/daemon/log_funcs.h +++ b/daemon/log_funcs.h @@ -47,6 +47,16 @@ INLINE void log_info_pop(void) { g_slice_free1(sizeof(*next), next); log_info_stack = g_slist_delete_link(log_info_stack, log_info_stack); } +// should be used with non-refcounted log info pieces +INLINE void log_info_pop_until(void *p) { + assert(p != NULL); + while (log_info.u.ptr) { + void *prev = log_info.u.ptr; + log_info_pop(); + if (prev == p) + break; + } +} // clears current log context and entire stack INLINE void log_info_reset(void) { __log_info_release(&log_info); diff --git a/t/log_funcs.h b/t/log_funcs.h index 5ce34a8a1..d1444f007 100644 --- a/t/log_funcs.h +++ b/t/log_funcs.h @@ -12,6 +12,8 @@ INLINE void log_info_reset(void) { } INLINE void log_info_pop(void) { } +INLINE void log_info_pop_until(void *p) { +} INLINE void log_info_call(struct call *c) { } INLINE void log_info_stream_fd(struct stream_fd *sfd) {