fix mem leak

This commit is contained in:
Jacek Jendrzej
2017-09-18 08:56:02 +02:00
parent 5a48398bb4
commit a7942c9987

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