From f0e12cbadcb10064eb417e35b1e4d3a86bae70fb Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Mon, 11 Feb 2013 21:10:19 +0100 Subject: [PATCH] Fixed invalid use of freed memory. --- src/platforms/posix/posixHandler.cpp | 3 ++- src/platforms/windows/windowsHandler.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp index 43fed99f..371da4d6 100644 --- a/src/platforms/posix/posixHandler.cpp +++ b/src/platforms/posix/posixHandler.cpp @@ -216,8 +216,9 @@ const vmime::string posixHandler::getHostName() const { if (isFQDN(p->ai_canonname)) { + const string ret(p->ai_canonname); freeaddrinfo(info); - return p->ai_canonname; + return ret; } } diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp index 88ba786c..e399cb50 100644 --- a/src/platforms/windows/windowsHandler.cpp +++ b/src/platforms/windows/windowsHandler.cpp @@ -241,8 +241,9 @@ const vmime::string windowsHandler::getHostName() const { if (isFQDN(p->ai_canonname)) { + const string ret(p->ai_canonname); freeaddrinfo(info); - return p->ai_canonname; + return ret; } }