Merge pull request #76 from maxim-ky/master
Made some destructors virtual and fixed a user-after-free bug
This commit is contained in:
commit
979128782b
|
|
@ -25,7 +25,7 @@ add_subdirectory(src)
|
|||
add_subdirectory(include)
|
||||
|
||||
add_library(amqp-cpp STATIC ${SRCS})
|
||||
target_include_directories(amqp-cpp SYSTEM PUBLIC ${PROJECT_SOURCE_DIR})
|
||||
include_directories(${PROJECT_SOURCE_DIR})
|
||||
install(TARGETS amqp-cpp
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
|
|
|
|||
2
Makefile
2
Makefile
|
|
@ -1,4 +1,4 @@
|
|||
PREFIX = /usr
|
||||
PREFIX ?= /usr
|
||||
INCLUDE_DIR = ${PREFIX}/include
|
||||
LIBRARY_DIR = ${PREFIX}/lib
|
||||
export LIBRARY_NAME = amqpcpp
|
||||
|
|
|
|||
|
|
@ -31,6 +31,11 @@ namespace AMQP {
|
|||
class Buffer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~Buffer() {}
|
||||
|
||||
/**
|
||||
* Total size of the buffer
|
||||
* @return size_t
|
||||
|
|
|
|||
|
|
@ -36,6 +36,11 @@ class Connection;
|
|||
class ConnectionHandler
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~ConnectionHandler() = default;
|
||||
|
||||
/**
|
||||
* Method that is called when the heartbeat frequency is negotiated
|
||||
* between the server and the client. You normally do not have to
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
*/
|
||||
#include "envelope.h"
|
||||
#include <limits>
|
||||
#include <stdexcept>
|
||||
|
||||
/**
|
||||
* Set up namespace
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public:
|
|||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~TcpConnection() = default;
|
||||
virtual ~TcpConnection() noexcept {}
|
||||
|
||||
/**
|
||||
* Process the TCP connection
|
||||
|
|
|
|||
|
|
@ -30,6 +30,11 @@ class TcpConnection;
|
|||
class TcpHandler
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~TcpHandler() {}
|
||||
|
||||
/**
|
||||
* Method that is called when the heartbeat frequency is negotiated
|
||||
* between the server and the client.
|
||||
|
|
|
|||
|
|
@ -123,7 +123,8 @@ uint64_t ConnectionImpl::parse(const Buffer &buffer)
|
|||
try
|
||||
{
|
||||
// try to recognize the frame
|
||||
ReceivedFrame receivedFrame(ReducedBuffer(buffer, processed), _maxFrame);
|
||||
ReducedBuffer reduced_buf(buffer, processed);
|
||||
ReceivedFrame receivedFrame(reduced_buf, _maxFrame);
|
||||
|
||||
// do we have the full frame?
|
||||
if (receivedFrame.complete())
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
#include <unistd.h>
|
||||
#include <netinet/tcp.h>
|
||||
#include <functional>
|
||||
#include <stdexcept>
|
||||
|
||||
// forward declarations
|
||||
#include "../include/classes.h"
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ Table::Table(const Table &table)
|
|||
// since a map is always ordered, we know that each element will
|
||||
// be inserted at the end of the new map, so we can simply use
|
||||
// emplace_hint and hint at insertion at the end of the map
|
||||
_fields.emplace_hint(_fields.end(), std::make_pair(iter->first, iter->second->clone()));
|
||||
_fields.insert(_fields.end(), std::make_pair(iter->first, iter->second->clone()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public:
|
|||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~TcpClosed() = default;
|
||||
virtual ~TcpClosed() noexcept = default;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -108,7 +108,7 @@ public:
|
|||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~TcpConnected()
|
||||
virtual ~TcpConnected() noexcept
|
||||
{
|
||||
// we no longer have to monitor the socket
|
||||
_handler->monitor(_connection, _socket, 0);
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public:
|
|||
/**
|
||||
* Destructor
|
||||
*/
|
||||
virtual ~TcpResolver()
|
||||
virtual ~TcpResolver() noexcept
|
||||
{
|
||||
// stop monitoring the pipe filedescriptor
|
||||
_handler->monitor(_connection, _pipe.in(), 0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue