Fix bad frees if exceptions are thrown by constructors.
authorCarl Hetherington <cth@carlh.net>
Thu, 19 Sep 2013 20:20:56 +0000 (21:20 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 19 Sep 2013 20:20:56 +0000 (21:20 +0100)
src/certificates.cc

index 6d9c449dab371f2995a46ca2a64d23b5c59a6a21..d02754f1f098ccaa07c9d117dba821477c93da76 100644 (file)
@@ -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 ());