Commit 8e980f1a authored by Michael Burkat's avatar Michael Burkat

potential fixes to memory leak

parent b60e1433
......@@ -75,6 +75,8 @@ public:
Message(Message&& other) = default;
Message& operator=(Message&& other) = default;
virtual ~Message() {}
protected:
Version version_;
Code code_;
......@@ -150,12 +152,14 @@ private:
Request();
#ifdef LIBSTDCPP_SMARTPTR_LOCK_FIXME
public:
void associatePeer(const std::shared_ptr<Tcp::Peer>& peer) {
if (peer_.use_count() > 0)
throw std::runtime_error("A peer was already associated to the response");
peer_ = peer;
}
private:
#endif
Method method_;
......@@ -576,6 +580,7 @@ namespace Private {
Step(Message* request)
: message(request)
{ }
virtual ~Step() {}
virtual State apply(StreamCursor& cursor) = 0;
......@@ -663,6 +668,8 @@ namespace Private {
ParserBase(const ParserBase& other) = delete;
ParserBase(ParserBase&& other) = default;
virtual ~ParserBase() {}
bool feed(const char* data, size_t len);
virtual void reset();
......
......@@ -12,6 +12,7 @@
/* In a sense, a Prototype is just a class that provides a clone() method */
template<typename Class>
struct Prototype {
virtual ~Prototype() {}
virtual std::shared_ptr<Class> clone() const = 0;
};
......
......@@ -417,6 +417,12 @@ Accept::parseRaw(const char *str, size_t len) {
void
Accept::write(std::ostream& os) const {
for (size_t i = 0; i < mediaRange_.size(); i++) {
os << mediaRange_[i].toString();
if (i != mediaRange_.size() - 1) {
os << ",";
}
}
}
void
......
......@@ -77,7 +77,6 @@ Registry::isRegistered(const std::string& name) {
Collection&
Collection::add(const std::shared_ptr<Header>& header) {
headers.insert(std::make_pair(header->name(), header));
return *this;
}
......
......@@ -210,7 +210,7 @@ Listener::run() {
int ready_fds = poller.poll(events, 128, std::chrono::milliseconds(-1));
if (ready_fds == -1) {
if (errno == EINTR && g_listen_fd == -1) return;
if (errno == EINTR) continue;
throw Error::system("Polling");
}
else if (ready_fds > 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment