From 30e2f6f873002d16aeae707879ea15c1c63a4323 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 19 Sep 2013 21:20:56 +0100 Subject: Fix bad frees if exceptions are thrown by constructors. --- src/certificates.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/certificates.cc b/src/certificates.cc index 6d9c449d..d02754f1 100644 --- a/src/certificates.cc +++ b/src/certificates.cc @@ -57,11 +57,13 @@ Certificate::Certificate (boost::filesystem::path filename) } Certificate::Certificate (string cert) + : _certificate (0) { read_string (cert); } Certificate::Certificate (Certificate const & other) + : _certificate (0) { read_string (other.certificate (true)); } @@ -93,7 +95,7 @@ Certificate::operator= (Certificate const & other) if (this == &other) { return *this; } - + X509_free (_certificate); read_string (other.certificate ()); -- cgit v1.2.3