]> git.netwichtig.de Git - user/henk/code/inspircd.git/commitdiff
Fix issues discovered by Coverity
authorDaniel Vassdal <shutter@canternet.org>
Mon, 25 Nov 2013 00:04:32 +0000 (16:04 -0800)
committerAttila Molnar <attilamolnar@hush.com>
Wed, 18 Dec 2013 15:10:33 +0000 (16:10 +0100)
- Fix resource leak in InspIRCd::Format()
- Explicitly set NewServices to NULL before the object it points to goes out of scope

src/helperfuncs.cpp
src/modules.cpp

index 590b993d14b9b1de905f827d86e873db117c2ff9..1899ce1b328469791a0c7185ee4ff60601919139 100644 (file)
@@ -400,6 +400,8 @@ const char* InspIRCd::Format(va_list &vaList, const char* formatString)
                va_copy(dst, vaList);
 
                int vsnret = vsnprintf(&formatBuffer[0], formatBuffer.size(), formatString, dst);
+               va_end(dst);
+
                if (vsnret > 0 && static_cast<unsigned>(vsnret) < formatBuffer.size())
                {
                        return &formatBuffer[0];
index 92f619743d11f0b640c57539f8eb0765b49b9a8a..2157d194866cbfd8f365f16bfee334d11fc66007 100644 (file)
@@ -550,6 +550,8 @@ void ModuleManager::LoadAll()
                }
        }
 
+       this->NewServices = NULL;
+
        if (!PrioritizeHooks())
                ServerInstance->Exit(EXIT_STATUS_MODULE);
 }