aboutsummaryrefslogtreecommitdiffstats
path: root/doc/examples
diff options
context:
space:
mode:
authorlloyd <[email protected]>2012-07-09 19:27:50 +0000
committerlloyd <[email protected]>2012-07-09 19:27:50 +0000
commitf598db001a535d88d603d954df8532a4020a3cfe (patch)
tree4af485c6364ca4f3aa78d705e97389d002d6130b /doc/examples
parent89f327ba20562edfb84dcad2dfc3a18c01e1d35f (diff)
Fix leak in read_ssh example, reported by Martin Olsson to the mailing list
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/read_ssh.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/doc/examples/read_ssh.cpp b/doc/examples/read_ssh.cpp
index 0392786a5..7ef81b346 100644
--- a/doc/examples/read_ssh.cpp
+++ b/doc/examples/read_ssh.cpp
@@ -8,12 +8,13 @@
* Example of reading SSH2 format public keys (see RFC 4716)
*/
-#include <fstream>
#include <botan/x509_key.h>
#include <botan/filters.h>
#include <botan/loadstor.h>
#include <botan/rsa.h>
#include <botan/dsa.h>
+#include <fstream>
+#include <memory>
using namespace Botan;
@@ -115,7 +116,7 @@ int main()
{
LibraryInitializer init;
- Public_Key* key = read_ssh_pubkey("dsa.ssh");
+ std::unique_ptr<Public_Key> key(read_ssh_pubkey("dsa.ssh"));
if(key == 0)
{