From 1430123e587226d8cfe5e43ef45e6d0e38dd14d1 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 17 May 2015 22:34:18 +0200 Subject: [PATCH] Reset the pointer to NULL after deleting it in wxCmdLineArgsArray. This ensures that a dangling pointer can't be dereferenced later and fixes a fatal bug if wxCmdLineArgsArray::operator=() was called more than once (which is however not supposed to normally happen). --- include/wx/cmdargs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/wx/cmdargs.h b/include/wx/cmdargs.h index e4167f0fd6..e34ba52a98 100644 --- a/include/wx/cmdargs.h +++ b/include/wx/cmdargs.h @@ -113,7 +113,7 @@ public: private: template - void Free(T **args) + void Free(T**& args) { if ( !args ) return; @@ -123,6 +123,7 @@ private: free(args[n]); delete [] args; + args = NULL; } void FreeArgs()