From 90e1ba7308826d7c906730960509cbbc27e9b601 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 25 Aug 2012 19:49:19 +0200 Subject: [PATCH] buffer_stream: do not crash on shutdown When destructing the users, they attempt to drop the ring they own. This works by checking Strm's list of rings. But when Strm is destructed, all rings are deleted as well which results in a segfault. --- src/buffer_stream.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/buffer_stream.cpp b/src/buffer_stream.cpp index f3c076fa..4b506a34 100644 --- a/src/buffer_stream.cpp +++ b/src/buffer_stream.cpp @@ -27,7 +27,6 @@ Buffer::Stream::Stream(){ /// Do cleanup on delete. Buffer::Stream::~Stream(){ - delete Strm; while (users.size() > 0){ stats_mutex.lock(); for (usersIt = users.begin(); usersIt != users.end(); usersIt++){ @@ -42,6 +41,7 @@ Buffer::Stream::~Stream(){ moreData.notify_all(); cleanUsers(); } + delete Strm; } /// Calculate and return the current statistics in JSON format.