]> granicus.if.org Git - icinga2/commitdiff
Fix leak in ConfigCompiler::CompileStream
authorGunnar Beutner <gunnar@beutner.name>
Thu, 19 Mar 2015 07:17:57 +0000 (08:17 +0100)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 19 Mar 2015 07:17:57 +0000 (08:17 +0100)
refs #8791

lib/config/configcompiler.cpp

index 5f255f253c92eddb81f0fc65dfd355b1f9204d03..8fc48c64fc2e43bcf333cd94929eeb10f1d31bd1 100644 (file)
@@ -207,12 +207,17 @@ Expression *ConfigCompiler::CompileStream(const String& path, std::istream *stre
                Utility::QueueAsyncCallback(boost::bind(&ConfigCompiler::CompileHelper, ctx));
                return new FutureExpression(ftr);
        } else {
+               Expression *expr;
+
                try {
-                       return ctx->Compile();
+                       expr = ctx->Compile();
                } catch (...) {
                        delete ctx;
                        throw;
                }
+
+               delete ctx;
+               return expr;
        }
 }