From: Hosang Kim Date: Tue, 13 Dec 2022 11:59:08 +0000 (+0900) Subject: aurum: fix using new/delete instead of variable-sized array. X-Git-Tag: accepted/tizen/unified/20230105.154713^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c5e5e31d6d2a1ad73f1ac04992730100162043fa;p=platform%2Fcore%2Fuifw%2Faurum.git aurum: fix using new/delete instead of variable-sized array. This reverts commit 0f2e8dac34da4f1e5c4d6d0a3537226dd9e99f10. Change-Id: I39024c57526ce3d060d4744a18a013c9903588d3 --- diff --git a/org.tizen.aurum-bootstrap/src/Commands/TakeScreenshotCommand.cc b/org.tizen.aurum-bootstrap/src/Commands/TakeScreenshotCommand.cc index 2a62457..5825eef 100644 --- a/org.tizen.aurum-bootstrap/src/Commands/TakeScreenshotCommand.cc +++ b/org.tizen.aurum-bootstrap/src/Commands/TakeScreenshotCommand.cc @@ -49,8 +49,9 @@ TakeScreenshotCommand::TakeScreenshotCommand( std::ifstream ifs(path, std::ifstream::binary); ::aurum::RspTakeScreenshot rsp; - int size = mDevice->getScreenSize().width * mDevice->getScreenSize().height; - char *buf = (char *) calloc(size, sizeof(char)); + const Size2D screenSize = mDevice->getScreenSize(); + int size = screenSize.width * screenSize.height; + char *buf = new char[size]; while (!ifs.eof()) { ifs.read(buf, size); @@ -58,6 +59,7 @@ TakeScreenshotCommand::TakeScreenshotCommand( mWriter->Write(rsp); } ifs.close(); + delete[] buf; return grpc::Status::OK; }