Merge pull request #7020 from Icinga/bugfix/elasticsearchwriter-oom-7018

ElasticsearchWriter: don't leak sockets
This commit is contained in:
Michael Friedrich 2019-03-18 16:39:43 +01:00 committed by GitHub
commit 00b8fb1f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include "icinga/compatutility.hpp"
#include "icinga/service.hpp"
#include "icinga/checkcommand.hpp"
#include "base/defer.hpp"
#include "base/tcpsocket.hpp"
#include "base/stream.hpp"
#include "base/base64.hpp"
@ -445,6 +446,8 @@ void ElasticsearchWriter::SendRequest(const String& body)
if (!stream)
return;
Defer close ([&stream]() { stream->Close(); });
HttpRequest req(stream);
/* Specify required headers by Elasticsearch. */