winlin

fix memory leak at handshake. 2.0.213

... ... @@ -340,6 +340,8 @@ Remark:
## History
* v2.0, 2016-09-05, fix memory leak at handshake. 2.0.213
* v2.0, 2016-09-04, support valgrind for [patched st](https://github.com/ossrs/state-threads/issues/2).
* v2.0, 2016-09-03, support all arm for [patched st](https://github.com/ossrs/state-threads/issues/1). 2.0.212
* v2.0, 2016-09-01, workaround [#511][bug #511] the fly stfd in close. 2.0.211
* v2.0, 2016-08-30, comment the pcr.
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 212
#define VERSION_REVISION 213
// generated by configure, only macros.
#include <srs_auto_headers.hpp>
... ...
... ... @@ -152,6 +152,11 @@ namespace _srs_internal
SrsDH::~SrsDH()
{
close();
}
void SrsDH::close()
{
if (pdh != NULL) {
if (pdh->p != NULL) {
BN_free(pdh->p);
... ... @@ -249,7 +254,9 @@ namespace _srs_internal
{
int ret = ERROR_SUCCESS;
int32_t bits_count = 1024;
int32_t bits_count = 1024;
close();
//1. Create the DH
if ((pdh = DH_new()) == NULL) {
... ...
... ... @@ -59,6 +59,8 @@ namespace _srs_internal
public:
SrsDH();
virtual ~SrsDH();
private:
virtual void close();
public:
/**
* initialize dh, generate the public and private key.
... ...