From 8d6ca820a704064870c713efd3c325d54bf17d90 Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 18 Jun 2007 22:53:37 +0000 Subject: Helps if it compiles git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7389 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspircd.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/inspircd.cpp') diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 3e063c26b..eb8894c43 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -954,9 +954,10 @@ bool InspIRCd::LoadModule(const char* filename) } } Module* m = NULL; + ircd_module* a = NULL; try { - ircd_module* a = new ircd_module(this, modfile); + a = new ircd_module(this, modfile); factory[this->ModCount+1] = a; if (factory[this->ModCount+1]->LastError()) { @@ -1002,7 +1003,8 @@ bool InspIRCd::LoadModule(const char* filename) { this->Log(DEFAULT,"Unable to load %s",modfile); snprintf(MODERR,MAXBUF,"Factory function failed: Probably missing init_module() entrypoint."); - delete a; + if (a) + delete a; return false; } } @@ -1012,7 +1014,8 @@ bool InspIRCd::LoadModule(const char* filename) snprintf(MODERR,MAXBUF,"Factory function of %s threw an exception: %s", modexcept.GetSource(), modexcept.GetReason()); if (m) delete m; - delete a; + if (a) + delete a; return false; } } -- cgit v1.2.3