Skip to content

Commit

Permalink
InfluxdbWriter: don't leak sockets
Browse files Browse the repository at this point in the history
refs #6989
  • Loading branch information
Al2Klimov committed Mar 1, 2019
1 parent a9841a9 commit 2a6b122
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/perfdata/influxdbwriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "icinga/macroprocessor.hpp"
#include "icinga/icingaapplication.hpp"
#include "icinga/checkcommand.hpp"
#include "base/defer.hpp"
#include "base/tcpsocket.hpp"
#include "base/configtype.hpp"
#include "base/objectlock.hpp"
Expand Down Expand Up @@ -447,6 +448,8 @@ void InfluxdbWriter::Flush()
if (!stream)
return;

Defer close ([&stream]() { stream->Close(); });

Url::Ptr url = new Url();
url->SetScheme(GetSslEnable() ? "https" : "http");
url->SetHost(GetHost());
Expand Down

0 comments on commit 2a6b122

Please sign in to comment.