From 3fe7617f20768d4500719e83dc83247a9bae09e5 Mon Sep 17 00:00:00 2001 From: Jacek Jendrzej Date: Mon, 18 Sep 2017 08:56:02 +0200 Subject: [PATCH] fix mem leak Origin commit data ------------------ Branch: ni/coolstream Commit: https://github.com/neutrino-images/ni-neutrino/commit/a7942c9987928990349270845f6e5a1ac12f6bfa Author: Jacek Jendrzej Date: 2017-09-18 (Mon, 18 Sep 2017) ------------------ No further description and justification available within origin commit message! ------------------ This commit was generated by Migit --- src/nhttpd/tuxboxapi/controlapi.cpp | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/nhttpd/tuxboxapi/controlapi.cpp b/src/nhttpd/tuxboxapi/controlapi.cpp index 215ca5d17..847bdada0 100644 --- a/src/nhttpd/tuxboxapi/controlapi.cpp +++ b/src/nhttpd/tuxboxapi/controlapi.cpp @@ -2080,18 +2080,21 @@ void CControlAPI::ScreenshotCGI(CyhookHandler *hh) if(!hh->ParamList["name"].empty()) filename = hh->ParamList["name"]; - CScreenShot * sc = new CScreenShot("/tmp/" + filename + ".png", (CScreenShot::screenshot_format_t)0 /*PNG*/); - sc->EnableOSD(enableOSD); - sc->EnableVideo(enableVideo); + CScreenShot * screenshot = new CScreenShot("/tmp/" + filename + ".png", (CScreenShot::screenshot_format_t)0 /*PNG*/); + if(screenshot){ + screenshot->EnableOSD(enableOSD); + screenshot->EnableVideo(enableVideo); #if 0 - sc->Start(); - hh->SendOk(); // FIXME what if sc->Start() failed? + screenshot->Start(); + hh->SendOk(); // FIXME what if screenshot->Start() failed? #else - if (sc->StartSync()) - hh->SendOk(); - else - hh->SendError(); + if (screenshot->StartSync()) + hh->SendOk(); + else + hh->SendError(); #endif + delete screenshot; + } } //-----------------------------------------------------------------------------