From 191aafa32b174052ce83cad60b589485d1136712 Mon Sep 17 00:00:00 2001 From: Bob Polis Date: Fri, 30 Oct 2020 11:11:30 +0100 Subject: [PATCH] added destructor to requester for global cleanup --- requester.cpp | 4 ++++ requester.hpp | 1 + 2 files changed, 5 insertions(+) diff --git a/requester.cpp b/requester.cpp index 75e30f4..5899762 100644 --- a/requester.cpp +++ b/requester.cpp @@ -30,6 +30,10 @@ requester::requester() { curl_easy_setopt(_h.get(), CURLOPT_WRITEFUNCTION, write_data); } +requester::~requester() { + curl_global_cleanup(); +} + std::string requester::get(const std::string &url) { curl_easy_setopt(_h.get(), CURLOPT_URL, url.c_str()); std::vector buf; diff --git a/requester.hpp b/requester.hpp index 95288f1..ca70fe0 100644 --- a/requester.hpp +++ b/requester.hpp @@ -20,6 +20,7 @@ class requester { // this class is a RAII class for a curl handle requester(); + ~requester(); // perform a http get request std::string get(const std::string& url);