summaryrefslogtreecommitdiff
path: root/src/Platform.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-12-08 17:52:10 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2012-12-08 17:52:10 +0900
commit9d7bb9d01af2c0ef1b748ac2e240b20439285fd4 (patch)
tree32032f76f7040856ee7d22370be1bd49eb507c98 /src/Platform.cc
parenta8641b0998af7b2a5876a77d4f18c9a78230d6b1 (diff)
Release statically allocated resources for prefs and options
Not realeasing these resources does not hurt the correctness of the program, but memory leak detection tool, such as valgrind, reports it as potential memory leak. It is better to distinguish it from the real ones.
Diffstat (limited to 'src/Platform.cc')
-rw-r--r--src/Platform.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Platform.cc b/src/Platform.cc
index a2749a4e..298294ae 100644
--- a/src/Platform.cc
+++ b/src/Platform.cc
@@ -73,6 +73,8 @@
#include "message.h"
#include "fmt.h"
#include "console.h"
+#include "OptionParser.h"
+#include "prefs.h"
#ifdef HAVE_LIBGMP
# include "a2gmp.h"
#endif // HAVE_LIBGMP
@@ -172,7 +174,11 @@ bool Platform::tearDown()
#ifdef HAVE_WINSOCK2_H
WSACleanup();
#endif // HAVE_WINSOCK2_H
-
+ // Deletes statically allocated resources. This is done to
+ // distinguish memory leak from them. This is handly to use
+ // valgrind.
+ OptionParser::deleteInstance();
+ option::deletePrefResource();
return true;
}