From 832979c2db8d42160887299ffe3d4666f1a7d445 Mon Sep 17 00:00:00 2001 From: Colin Snover Date: Sun, 9 Oct 2016 11:32:01 -0500 Subject: SCI: Fix memory leak --- engines/sci/engine/kvideo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'engines/sci/engine') diff --git a/engines/sci/engine/kvideo.cpp b/engines/sci/engine/kvideo.cpp index ab216c51cf..83a02883af 100644 --- a/engines/sci/engine/kvideo.cpp +++ b/engines/sci/engine/kvideo.cpp @@ -165,7 +165,6 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { switch (argv[0].toUint16()) { case 0: { Common::String filename = s->_segMan->getString(argv[1]); - videoDecoder = new Video::AVIDecoder(); if (filename.equalsIgnoreCase("gk2a.avi")) { // HACK: Switch to 16bpp graphics for Indeo3. @@ -180,6 +179,8 @@ reg_t kShowMovie(EngineState *s, int argc, reg_t *argv) { } } + videoDecoder = new Video::AVIDecoder(); + if (!videoDecoder->loadFile(filename.c_str())) { warning("Failed to open movie file %s", filename.c_str()); delete videoDecoder; -- cgit v1.2.3