aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2015-05-03 06:20:36 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2015-05-03 06:20:36 +0200
commite000a6b4954cbf337112a36bb3a7cf8a6491a40f (patch)
treeff7406c8922648d0bcfb7797b384279cddf8f5a6
parentf308b3fb5dbb8eee5cd6894ab75d0d265572ada9 (diff)
downloadxK-e000a6b4954cbf337112a36bb3a7cf8a6491a40f.tar.gz
xK-e000a6b4954cbf337112a36bb3a7cf8a6491a40f.tar.xz
xK-e000a6b4954cbf337112a36bb3a7cf8a6491a40f.zip
degesch: fix segfault
-rw-r--r--degesch.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/degesch.c b/degesch.c
index 451d429..55fb325 100644
--- a/degesch.c
+++ b/degesch.c
@@ -1527,10 +1527,20 @@ buffer_send_internal (struct app_context *ctx, struct buffer *buffer,
buffer->lines_count++;
if (buffer == ctx->current_buffer)
+ {
buffer_line_display (ctx, line, false);
- else if (!ctx->isolate_buffers &&
- (buffer == ctx->global_buffer ||
- buffer == ctx->current_buffer->server->buffer))
+ return;
+ }
+
+ bool can_leak = false;
+ if ((buffer == ctx->global_buffer)
+ || (ctx->current_buffer->type == BUFFER_GLOBAL
+ && buffer->type == BUFFER_SERVER)
+ || (ctx->current_buffer->type != BUFFER_GLOBAL
+ && buffer == ctx->current_buffer->server->buffer))
+ can_leak = true;
+
+ if (!ctx->isolate_buffers && can_leak)
buffer_line_display (ctx, line, true);
else
{