fix mem leak

Origin commit data
------------------
Branch: ni/coolstream
Commit: a7942c9987
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2017-09-18 (Mon, 18 Sep 2017)


------------------
No further description and justification available within origin commit message!

------------------
This commit was generated by Migit
This commit is contained in:
Jacek Jendrzej
2017-09-18 08:56:02 +02:00
parent 3d8f8e6732
commit 3fe7617f20

View File

@@ -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())
if (screenshot->StartSync())
hh->SendOk();
else
hh->SendError();
#endif
delete screenshot;
}
}
//-----------------------------------------------------------------------------