Browse Source

Fix a small memory leak in etcd_state_client

Vitaliy Filippov 6 months ago
parent
commit
bc742ccf8c
  1. 12
      src/etcd_state_client.cpp
  2. 1
      src/etcd_state_client.h

12
src/etcd_state_client.cpp

@ -7,6 +7,16 @@
#include "http_client.h"
#include "base64.h"
etcd_state_client_t::~etcd_state_client_t()
{
etcd_watches_initialised = -1;
if (etcd_watch_ws)
{
etcd_watch_ws->close();
etcd_watch_ws = NULL;
}
}
json_kv_t etcd_state_client_t::parse_etcd_kv(const json11::Json & kv_json)
{
json_kv_t kv;
@ -160,7 +170,7 @@ void etcd_state_client_t::start_etcd_watcher()
start_etcd_watcher();
});
}
else
else if (etcd_watches_initialised > 0)
{
// Connection was live, retry immediately
start_etcd_watcher();

1
src/etcd_state_client.h

@ -81,4 +81,5 @@ struct etcd_state_client_t
void load_pgs();
void parse_state(const std::string & key, const json11::Json & value);
void parse_config(json11::Json & config);
~etcd_state_client_t();
};
Loading…
Cancel
Save