Merge pull request #247 from ryanmjacobs:fix_pointer_checks
This commit is contained in:
commit
34567bc496
@ -260,7 +260,6 @@ struct PNGChunk
|
||||
}
|
||||
~PNGChunk()
|
||||
{
|
||||
if (Data)
|
||||
delete[] Data;
|
||||
}
|
||||
};
|
||||
|
@ -462,9 +462,9 @@ int register_extension()
|
||||
returnval = 1;
|
||||
finalise:
|
||||
|
||||
if(iconname) free(iconname);
|
||||
if(opencommand) free(opencommand);
|
||||
if(currentfilename) free(currentfilename);
|
||||
free(iconname);
|
||||
free(opencommand);
|
||||
free(currentfilename);
|
||||
|
||||
return returnval;
|
||||
#elif defined(LIN)
|
||||
|
@ -343,10 +343,10 @@ bool Client::DoInstallation()
|
||||
returnval = 1;
|
||||
finalise:
|
||||
|
||||
if(iconname) free(iconname);
|
||||
if(opencommand) free(opencommand);
|
||||
if(protocolcommand) free(protocolcommand);
|
||||
if(currentfilename) free(currentfilename);
|
||||
free(iconname);
|
||||
free(opencommand);
|
||||
free(protocolcommand);
|
||||
free(currentfilename);
|
||||
|
||||
return returnval;
|
||||
#elif defined(LIN)
|
||||
@ -681,7 +681,6 @@ void Client::Tick()
|
||||
|
||||
if(status != 200)
|
||||
{
|
||||
if(data)
|
||||
free(data);
|
||||
}
|
||||
else if(data)
|
||||
@ -768,7 +767,6 @@ void Client::Tick()
|
||||
//Do nothing
|
||||
}
|
||||
|
||||
if(data)
|
||||
free(data);
|
||||
}
|
||||
}
|
||||
@ -952,7 +950,7 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
||||
{
|
||||
if(strncmp((const char *)data, "OK", 2)!=0)
|
||||
{
|
||||
if(gameData) delete[] gameData;
|
||||
delete[] gameData;
|
||||
lastError = std::string((const char *)data);
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
@ -973,14 +971,14 @@ RequestStatus Client::UploadSave(SaveInfo & save)
|
||||
}
|
||||
}
|
||||
free(data);
|
||||
if(gameData) delete[] gameData;
|
||||
delete[] gameData;
|
||||
return RequestOkay;
|
||||
}
|
||||
else if(data)
|
||||
{
|
||||
free(data);
|
||||
}
|
||||
if(gameData) delete[] gameData;
|
||||
delete[] gameData;
|
||||
return RequestFailure;
|
||||
}
|
||||
|
||||
@ -1400,7 +1398,6 @@ LoginStatus Client::Login(std::string username, std::string password, User & use
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return LoginError;
|
||||
}
|
||||
@ -1447,11 +1444,9 @@ RequestStatus Client::DeleteSave(int saveID)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
@ -1507,11 +1502,9 @@ RequestStatus Client::AddComment(int saveID, std::string comment)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
@ -1563,11 +1556,9 @@ RequestStatus Client::FavouriteSave(int saveID, bool favourite)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
@ -1621,11 +1612,9 @@ RequestStatus Client::ReportSave(int saveID, std::string message)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
@ -1675,11 +1664,9 @@ RequestStatus Client::UnpublishSave(int saveID)
|
||||
lastError = http_ret_text(dataStatus);
|
||||
goto failure;
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestOkay;
|
||||
failure:
|
||||
if(data)
|
||||
free(data);
|
||||
return RequestFailure;
|
||||
}
|
||||
@ -1698,7 +1685,6 @@ RequestStatus Client::PublishSave(int saveID)
|
||||
const char *const postDatas[] = { "" };
|
||||
size_t postLengths[] = { 1 };
|
||||
char *data = http_multipart_post(urlStream.str().c_str(), postNames, postDatas, postLengths, userIDStream.str().c_str(), NULL, authUser.SessionID.c_str(), &dataStatus, NULL);
|
||||
if (data)
|
||||
free(data);
|
||||
}
|
||||
else
|
||||
@ -1795,7 +1781,7 @@ SaveInfo * Client::GetSave(int saveID, int saveDate)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data) free(data);
|
||||
free(data);
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
return NULL;
|
||||
@ -2008,7 +1994,6 @@ std::vector<SaveComment*> * Client::GetComments(int saveID, int start, int count
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return commentArray;
|
||||
}
|
||||
@ -2057,7 +2042,6 @@ std::vector<std::pair<std::string, int> > * Client::GetTags(int start, int count
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return tagArray;
|
||||
}
|
||||
@ -2140,7 +2124,6 @@ std::vector<SaveInfo*> * Client::SearchSaves(int start, int count, std::string q
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return saveArray;
|
||||
}
|
||||
@ -2329,7 +2312,6 @@ std::list<std::string> * Client::RemoveTag(int saveID, std::string tag)
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return tags;
|
||||
}
|
||||
@ -2390,7 +2372,6 @@ std::list<std::string> * Client::AddTag(int saveID, std::string tag)
|
||||
{
|
||||
lastError = http_ret_text(dataStatus);
|
||||
}
|
||||
if(data)
|
||||
free(data);
|
||||
return tags;
|
||||
}
|
||||
|
@ -1075,16 +1075,12 @@ void GameSave::readOPS(char * data, int dataLength)
|
||||
fail:
|
||||
//Clean up everything
|
||||
bson_destroy(&b);
|
||||
if(freeIndices)
|
||||
free(freeIndices);
|
||||
if(partsSimIndex)
|
||||
free(partsSimIndex);
|
||||
throw ParseException(ParseException::Corrupt, "Save data corrupt");
|
||||
fin:
|
||||
bson_destroy(&b);
|
||||
if(freeIndices)
|
||||
free(freeIndices);
|
||||
if(partsSimIndex)
|
||||
free(partsSimIndex);
|
||||
}
|
||||
|
||||
@ -2191,27 +2187,16 @@ char * GameSave::serialiseOPS(unsigned int & dataLength)
|
||||
|
||||
fin:
|
||||
bson_destroy(&b);
|
||||
if(partsData)
|
||||
free(partsData);
|
||||
if(wallData)
|
||||
free(wallData);
|
||||
if(fanData)
|
||||
free(fanData);
|
||||
if (elementCount)
|
||||
delete[] elementCount;
|
||||
if (partsSaveIndex)
|
||||
free(partsSaveIndex);
|
||||
if (soapLinkData)
|
||||
free(soapLinkData);
|
||||
if (partsPosData)
|
||||
free(partsPosData);
|
||||
if (partsPosFirstMap)
|
||||
free(partsPosFirstMap);
|
||||
if (partsPosLastMap)
|
||||
free(partsPosLastMap);
|
||||
if (partsPosCount)
|
||||
free(partsPosCount);
|
||||
if (partsPosLink)
|
||||
free(partsPosLink);
|
||||
|
||||
return (char*)outputData;
|
||||
|
@ -557,7 +557,6 @@ int http_async_req_status(void *ctx)
|
||||
{
|
||||
cx->tptr = 0;
|
||||
cx->tlen = 0;
|
||||
if (cx->tbuf)
|
||||
free(cx->tbuf);
|
||||
cx->state = HTS_RECV;
|
||||
}
|
||||
@ -684,10 +683,8 @@ void http_async_req_close(void *ctx)
|
||||
{
|
||||
cx->keep = 1;
|
||||
tmp = http_async_req_stop(ctx, NULL, NULL);
|
||||
if (tmp)
|
||||
free(tmp);
|
||||
}
|
||||
if (cx->fdhost)
|
||||
free(cx->fdhost);
|
||||
PCLOSE(cx->fd);
|
||||
free(ctx);
|
||||
@ -1088,7 +1085,6 @@ retry:
|
||||
return http_async_req_stop(ctx, ret, len);
|
||||
|
||||
fail:
|
||||
if (data)
|
||||
free(data);
|
||||
if (own_plen)
|
||||
free(plens);
|
||||
@ -1278,7 +1274,6 @@ retry:
|
||||
return ctx;
|
||||
|
||||
fail:
|
||||
if (data)
|
||||
free(data);
|
||||
if (own_plen)
|
||||
free(plens);
|
||||
|
@ -65,9 +65,7 @@ void SaveFile::SetDisplayName(std::string displayName)
|
||||
}
|
||||
|
||||
SaveFile::~SaveFile() {
|
||||
if(gameSave)
|
||||
delete gameSave;
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,6 @@ GameSave * SaveInfo::GetGameSave()
|
||||
|
||||
void SaveInfo::SetGameSave(GameSave * saveGame)
|
||||
{
|
||||
if(gameSave)
|
||||
delete gameSave;
|
||||
gameSave = saveGame;
|
||||
}
|
||||
|
@ -61,7 +61,6 @@ RequestBroker::ProcessResponse APIRequest::Process(RequestBroker & rb)
|
||||
//#ifdef DEBUG
|
||||
std::cout << typeid(*this).name() << " Request for " << URL << " failed with status " << status << std::endl;
|
||||
//#endif
|
||||
if(data)
|
||||
free(data);
|
||||
|
||||
return RequestBroker::Failed;
|
||||
|
@ -76,7 +76,6 @@ RequestBroker::ProcessResponse ImageRequest::Process(RequestBroker & rb)
|
||||
#ifdef DEBUG
|
||||
std::cout << typeid(*this).name() << " Request for " << URL << " failed with status " << status << std::endl;
|
||||
#endif
|
||||
if(data)
|
||||
free(data);
|
||||
|
||||
return RequestBroker::Failed;
|
||||
|
@ -38,7 +38,6 @@ RequestBroker::ProcessResponse ThumbRenderRequest::Process(RequestBroker & rb)
|
||||
|
||||
ThumbRenderRequest::~ThumbRenderRequest()
|
||||
{
|
||||
if(Save)
|
||||
delete Save;
|
||||
}
|
||||
|
||||
|
@ -60,7 +60,6 @@ RequestBroker::ProcessResponse WebRequest::Process(RequestBroker & rb)
|
||||
//#ifdef DEBUG
|
||||
std::cout << typeid(*this).name() << " Request for " << URL << " failed with status " << status << std::endl;
|
||||
//#endif
|
||||
if(data)
|
||||
free(data);
|
||||
|
||||
return RequestBroker::Failed;
|
||||
|
@ -317,7 +317,6 @@ void ColourPickerActivity::OnDraw()
|
||||
}
|
||||
|
||||
ColourPickerActivity::~ColourPickerActivity() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,6 @@ ConsoleView * ConsoleController::GetView()
|
||||
ConsoleController::~ConsoleController() {
|
||||
if(ui::Engine::Ref().GetWindow() == consoleView)
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete consoleModel;
|
||||
delete consoleView;
|
||||
|
@ -144,7 +144,6 @@ void ConfirmPrompt::OnDraw()
|
||||
}
|
||||
|
||||
ConfirmPrompt::~ConfirmPrompt() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ void ErrorMessage::OnDraw()
|
||||
}
|
||||
|
||||
ErrorMessage::~ErrorMessage() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,6 @@ void TextPrompt::OnDraw()
|
||||
}
|
||||
|
||||
TextPrompt::~TextPrompt() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -332,6 +332,5 @@ void FileBrowserActivity::OnDraw()
|
||||
|
||||
FileBrowserActivity::~FileBrowserActivity()
|
||||
{
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
@ -51,7 +51,6 @@ public:
|
||||
{
|
||||
if(origBitmap)
|
||||
{
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
bitmap = new unsigned char[size.X*size.Y];
|
||||
if(size == origSize)
|
||||
@ -88,7 +87,6 @@ public:
|
||||
}
|
||||
virtual ~BitmapBrush()
|
||||
{
|
||||
if(origBitmap)
|
||||
delete[] origBitmap;
|
||||
}
|
||||
};
|
||||
|
@ -18,7 +18,6 @@ protected:
|
||||
GenerateBitmap();
|
||||
if(!bitmap)
|
||||
return;
|
||||
if(outline)
|
||||
delete[] outline;
|
||||
outline = new unsigned char[size.X*size.Y];
|
||||
for(int x = 0; x < size.X; x++)
|
||||
@ -64,9 +63,7 @@ public:
|
||||
updateOutline();
|
||||
}
|
||||
virtual ~Brush() {
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
if(outline)
|
||||
delete[] outline;
|
||||
}
|
||||
virtual void RenderRect(Renderer * ren, ui::Point position1, ui::Point position2);
|
||||
@ -75,7 +72,6 @@ public:
|
||||
virtual void RenderFill(Renderer * ren, ui::Point position);
|
||||
virtual void GenerateBitmap()
|
||||
{
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
bitmap = new unsigned char[size.X*size.Y];
|
||||
for(int x = 0; x < size.X; x++)
|
||||
|
@ -14,7 +14,6 @@ public:
|
||||
}
|
||||
virtual void GenerateBitmap()
|
||||
{
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
bitmap = new unsigned char[size.X*size.Y];
|
||||
int rx = radius.X;
|
||||
|
@ -1223,7 +1223,6 @@ void GameController::OpenTags()
|
||||
{
|
||||
if(gameModel->GetSave() && gameModel->GetSave()->GetID())
|
||||
{
|
||||
if (tagsWindow)
|
||||
delete tagsWindow;
|
||||
tagsWindow = new TagsController(new TagsCallback(this), gameModel->GetSave());
|
||||
ui::Engine::Ref().ShowWindow(tagsWindow->GetView());
|
||||
|
@ -176,13 +176,9 @@ GameModel::~GameModel()
|
||||
}
|
||||
delete sim;
|
||||
delete ren;
|
||||
if(placeSave)
|
||||
delete placeSave;
|
||||
if(clipboard)
|
||||
delete clipboard;
|
||||
if(currentSave)
|
||||
delete currentSave;
|
||||
if(currentFile)
|
||||
delete currentFile;
|
||||
//if(activeTools)
|
||||
// delete[] activeTools;
|
||||
@ -556,14 +552,12 @@ void GameModel::SetSave(SaveInfo * newSave)
|
||||
{
|
||||
if(currentSave != newSave)
|
||||
{
|
||||
if(currentSave)
|
||||
delete currentSave;
|
||||
if(newSave == NULL)
|
||||
currentSave = NULL;
|
||||
else
|
||||
currentSave = new SaveInfo(*newSave);
|
||||
}
|
||||
if(currentFile)
|
||||
delete currentFile;
|
||||
currentFile = NULL;
|
||||
|
||||
@ -599,14 +593,12 @@ void GameModel::SetSaveFile(SaveFile * newSave)
|
||||
{
|
||||
if(currentFile != newSave)
|
||||
{
|
||||
if(currentFile)
|
||||
delete currentFile;
|
||||
if(newSave == NULL)
|
||||
currentFile = NULL;
|
||||
else
|
||||
currentFile = new SaveFile(*newSave);
|
||||
}
|
||||
if (currentSave)
|
||||
delete currentSave;
|
||||
currentSave = NULL;
|
||||
|
||||
@ -907,7 +899,6 @@ void GameModel::SetPlaceSave(GameSave * save)
|
||||
{
|
||||
if(save != placeSave)
|
||||
{
|
||||
if(placeSave)
|
||||
delete placeSave;
|
||||
if(save)
|
||||
placeSave = new GameSave(*save);
|
||||
@ -919,7 +910,6 @@ void GameModel::SetPlaceSave(GameSave * save)
|
||||
|
||||
void GameModel::SetClipboard(GameSave * save)
|
||||
{
|
||||
if(clipboard)
|
||||
delete clipboard;
|
||||
clipboard = save;
|
||||
}
|
||||
|
@ -142,7 +142,6 @@ public:
|
||||
}
|
||||
virtual ~SplitButton()
|
||||
{
|
||||
if(splitActionCallback)
|
||||
delete splitActionCallback;
|
||||
}
|
||||
};
|
||||
@ -460,7 +459,6 @@ GameView::~GameView()
|
||||
|
||||
}
|
||||
|
||||
if(placeSaveThumb)
|
||||
delete placeSaveThumb;
|
||||
}
|
||||
|
||||
@ -728,7 +726,6 @@ void GameView::NotifyToolListChanged(GameModel * sender)
|
||||
tempButton->SetActionCallback(new ToolAction(this, toolList[i]));
|
||||
|
||||
tempButton->Appearance.SetTexture(tempTexture);
|
||||
if(tempTexture)
|
||||
delete tempTexture;
|
||||
|
||||
tempButton->Appearance.BackgroundInactive = ui::Colour(toolList[i]->colRed, toolList[i]->colGreen, toolList[i]->colBlue);
|
||||
@ -1867,7 +1864,6 @@ void GameView::NotifyLogChanged(GameModel * sender, string entry)
|
||||
|
||||
void GameView::NotifyPlaceSaveChanged(GameModel * sender)
|
||||
{
|
||||
if(placeSaveThumb)
|
||||
delete placeSaveThumb;
|
||||
if(sender->GetPlaceSave())
|
||||
{
|
||||
|
@ -21,7 +21,6 @@ public:
|
||||
};
|
||||
virtual void GenerateBitmap()
|
||||
{
|
||||
if(bitmap)
|
||||
delete[] bitmap;
|
||||
bitmap = new unsigned char[size.X*size.Y];
|
||||
int rx = radius.X;
|
||||
|
@ -37,7 +37,6 @@ namespace ui
|
||||
|
||||
void Appearance::SetTexture(VideoBuffer * texture)
|
||||
{
|
||||
if(this->texture)
|
||||
delete this->texture;
|
||||
if(texture)
|
||||
this->texture = new VideoBuffer(texture);
|
||||
@ -47,7 +46,6 @@ namespace ui
|
||||
|
||||
Appearance::~Appearance()
|
||||
{
|
||||
if(texture)
|
||||
delete texture;
|
||||
}
|
||||
|
||||
|
@ -25,9 +25,7 @@ AvatarButton::AvatarButton(Point position, Point size, std::string username):
|
||||
AvatarButton::~AvatarButton()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
if(avatar)
|
||||
delete avatar;
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
@ -45,7 +43,6 @@ void AvatarButton::OnResponseReady(void * imagePtr, int identifier)
|
||||
VideoBuffer * image = (VideoBuffer*)imagePtr;
|
||||
if(image)
|
||||
{
|
||||
if(avatar)
|
||||
delete avatar;
|
||||
avatar = image;
|
||||
}
|
||||
|
@ -219,14 +219,12 @@ void Button::DoAltAction()
|
||||
|
||||
void Button::SetActionCallback(ButtonAction * action)
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
actionCallback = action;
|
||||
}
|
||||
|
||||
Button::~Button()
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
|
@ -96,13 +96,11 @@ void Checkbox::Draw(const Point& screenPos)
|
||||
|
||||
void Checkbox::SetActionCallback(CheckboxAction * action)
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
actionCallback = action;
|
||||
}
|
||||
|
||||
Checkbox::~Checkbox() {
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
|
@ -239,6 +239,5 @@ void Component::OnMouseWheelInside(int localx, int localy, int d)
|
||||
|
||||
Component::~Component()
|
||||
{
|
||||
if(menu)
|
||||
delete menu;
|
||||
}
|
||||
|
@ -190,7 +190,6 @@ void DropDown::OnMouseLeave(int x, int y)
|
||||
|
||||
|
||||
DropDown::~DropDown() {
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@ Engine::Engine():
|
||||
|
||||
Engine::~Engine()
|
||||
{
|
||||
if(state_ != NULL)
|
||||
delete state_;
|
||||
//Dispose of any Windows.
|
||||
while(!windows.empty())
|
||||
@ -47,7 +46,6 @@ Engine::~Engine()
|
||||
delete windows.top();
|
||||
windows.pop();
|
||||
}
|
||||
if (lastBuffer)
|
||||
free(lastBuffer);
|
||||
}
|
||||
|
||||
|
@ -46,7 +46,6 @@ Panel::~Panel()
|
||||
{
|
||||
for(unsigned i = 0; i < children.size(); ++i)
|
||||
{
|
||||
if( children[i] )
|
||||
delete children[i];
|
||||
}
|
||||
#ifdef OGLI
|
||||
|
@ -118,13 +118,9 @@ SaveButton::~SaveButton()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
if(save)
|
||||
delete save;
|
||||
if(file)
|
||||
delete file;
|
||||
}
|
||||
|
||||
@ -133,7 +129,6 @@ void SaveButton::OnResponseReady(void * imagePtr, int identifier)
|
||||
VideoBuffer * image = (VideoBuffer*)imagePtr;
|
||||
if(image)
|
||||
{
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
thumbnail = image;
|
||||
waitingForThumb = false;
|
||||
|
@ -68,7 +68,6 @@ void Slider::SetColour(Colour col1, Colour col2)
|
||||
{
|
||||
pixel pix[2] = {(pixel)PIXRGB(col1.Red, col1.Green, col1.Blue), (pixel)PIXRGB(col2.Red, col2.Green, col2.Blue)};
|
||||
float fl[2] = {0.0f, 1.0f};
|
||||
if(bgGradient)
|
||||
free(bgGradient);
|
||||
this->col1 = col1;
|
||||
this->col2 = col2;
|
||||
|
@ -35,7 +35,6 @@ Textbox::Textbox(Point position, Point size, std::string textboxText, std::strin
|
||||
|
||||
Textbox::~Textbox()
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
@ -566,7 +565,6 @@ Textbox::Textbox(Point position, Point size, std::string textboxText):
|
||||
|
||||
Textbox::~Textbox()
|
||||
{
|
||||
if(actionCallback)
|
||||
delete actionCallback;
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,6 @@ void LocalBrowserController::Exit()
|
||||
LocalBrowserController::~LocalBrowserController() {
|
||||
if(ui::Engine::Ref().GetWindow() == browserView)
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete browserModel;
|
||||
delete browserView;
|
||||
|
@ -50,7 +50,6 @@ SaveFile * LocalBrowserModel::GetSave()
|
||||
|
||||
void LocalBrowserModel::SetSave(SaveFile * newStamp)
|
||||
{
|
||||
if(stamp)
|
||||
delete stamp;
|
||||
stamp = new SaveFile(*newStamp);
|
||||
}
|
||||
@ -141,7 +140,6 @@ void LocalBrowserModel::notifySelectedChanged()
|
||||
}
|
||||
|
||||
LocalBrowserModel::~LocalBrowserModel() {
|
||||
if(stamp)
|
||||
delete stamp;
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,6 @@ OptionsController::~OptionsController() {
|
||||
}
|
||||
delete model;
|
||||
delete view;
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -192,7 +192,6 @@ PreviewController::~PreviewController() {
|
||||
Client::Ref().RemoveListener(this);
|
||||
delete previewModel;
|
||||
delete previewView;
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -139,13 +139,11 @@ void PreviewModel::OnResponseReady(void * object, int identifier)
|
||||
{
|
||||
if (identifier == 1)
|
||||
{
|
||||
if (saveData)
|
||||
delete saveData;
|
||||
saveData = (std::vector<unsigned char>*)object;
|
||||
}
|
||||
if (identifier == 2)
|
||||
{
|
||||
if (save)
|
||||
delete save;
|
||||
save = (SaveInfo*)object;
|
||||
}
|
||||
@ -243,9 +241,7 @@ void PreviewModel::AddObserver(PreviewView * observer)
|
||||
PreviewModel::~PreviewModel()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
if (save)
|
||||
delete save;
|
||||
if (saveData)
|
||||
delete saveData;
|
||||
if (saveComments)
|
||||
{
|
||||
|
@ -408,7 +408,6 @@ void PreviewView::OnKeyPress(int key, Uint16 character, bool shift, bool ctrl, b
|
||||
void PreviewView::NotifySaveChanged(PreviewModel * sender)
|
||||
{
|
||||
SaveInfo * save = sender->GetSave();
|
||||
if(savePreview)
|
||||
delete savePreview;
|
||||
savePreview = NULL;
|
||||
if(save)
|
||||
@ -624,7 +623,6 @@ PreviewView::~PreviewView()
|
||||
RemoveComponent(submitCommentButton);
|
||||
delete submitCommentButton;
|
||||
}
|
||||
if(savePreview)
|
||||
delete savePreview;
|
||||
}
|
||||
|
||||
|
@ -59,7 +59,6 @@ RenderController::~RenderController() {
|
||||
{
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
}
|
||||
if(callback)
|
||||
delete callback;
|
||||
delete renderModel;
|
||||
delete renderView;
|
||||
|
@ -135,7 +135,6 @@ void LocalSaveActivity::OnDraw()
|
||||
|
||||
void LocalSaveActivity::OnResponseReady(void * imagePtr, int identifier)
|
||||
{
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
thumbnail = (VideoBuffer*)imagePtr;
|
||||
}
|
||||
@ -143,8 +142,6 @@ void LocalSaveActivity::OnResponseReady(void * imagePtr, int identifier)
|
||||
LocalSaveActivity::~LocalSaveActivity()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
@ -358,7 +358,6 @@ void ServerSaveActivity::OnDraw()
|
||||
|
||||
void ServerSaveActivity::OnResponseReady(void * imagePtr, int identifier)
|
||||
{
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
thumbnail = (VideoBuffer *)imagePtr;
|
||||
}
|
||||
@ -366,10 +365,7 @@ void ServerSaveActivity::OnResponseReady(void * imagePtr, int identifier)
|
||||
ServerSaveActivity::~ServerSaveActivity()
|
||||
{
|
||||
RequestBroker::Ref().DetachRequestListener(this);
|
||||
if(saveUploadTask)
|
||||
delete saveUploadTask;
|
||||
if(callback)
|
||||
delete callback;
|
||||
if(thumbnail)
|
||||
delete thumbnail;
|
||||
}
|
||||
|
@ -99,7 +99,6 @@ void SearchController::Exit()
|
||||
|
||||
SearchController::~SearchController()
|
||||
{
|
||||
if(activePreview)
|
||||
delete activePreview;
|
||||
if(ui::Engine::Ref().GetWindow() == searchView)
|
||||
{
|
||||
@ -204,7 +203,6 @@ void SearchController::InstantOpen(bool instant)
|
||||
|
||||
void SearchController::OpenSave(int saveID)
|
||||
{
|
||||
if(activePreview)
|
||||
delete activePreview;
|
||||
Graphics * g = ui::Engine::Ref().g;
|
||||
g->fillrect(XRES/3, WINDOWH-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable
|
||||
@ -214,7 +212,6 @@ void SearchController::OpenSave(int saveID)
|
||||
|
||||
void SearchController::OpenSave(int saveID, int saveDate)
|
||||
{
|
||||
if(activePreview)
|
||||
delete activePreview;
|
||||
Graphics * g = ui::Engine::Ref().g;
|
||||
g->fillrect(XRES/3, WINDOWH-20, XRES/3, 20, 0, 0, 0, 150); //dim the "Page X of Y" a little to make the CopyTextButton more noticeable
|
||||
|
@ -278,6 +278,5 @@ void SearchModel::notifySelectedChanged()
|
||||
|
||||
SearchModel::~SearchModel()
|
||||
{
|
||||
if (loadedSave)
|
||||
delete loadedSave;
|
||||
}
|
||||
|
@ -68,6 +68,5 @@ void Thumbnail::Resize(ui::Point newSize)
|
||||
|
||||
Thumbnail::~Thumbnail()
|
||||
{
|
||||
if(Data)
|
||||
delete[] Data;
|
||||
}
|
||||
|
@ -47,7 +47,6 @@ TagsController::~TagsController() {
|
||||
ui::Engine::Ref().CloseWindow();
|
||||
delete tagsModel;
|
||||
delete tagsView;
|
||||
if(callback)
|
||||
delete callback;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@ private:
|
||||
data = http_async_req_stop(request, &status, &dataLength);
|
||||
if (status!=200)
|
||||
{
|
||||
if (data)
|
||||
free(data);
|
||||
errorStream << "Server responded with Status " << status;
|
||||
notifyError("Could not download update");
|
||||
|
@ -1944,10 +1944,10 @@ int luatpt_getscript(lua_State* l)
|
||||
}
|
||||
|
||||
fin:
|
||||
if(filedata) free(filedata);
|
||||
if(fileuri) delete[] fileuri;
|
||||
if(filename) delete[] filename;
|
||||
if(luacommand) delete[] luacommand;
|
||||
free(filedata);
|
||||
delete[] fileuri;
|
||||
delete[] filename;
|
||||
delete[] luacommand;
|
||||
luacommand = NULL;
|
||||
|
||||
if(lastError)
|
||||
|
@ -45,7 +45,7 @@ public:
|
||||
}
|
||||
~CoordStack()
|
||||
{
|
||||
if (stack) free(stack);
|
||||
free(stack);
|
||||
}
|
||||
void push(int x, int y)
|
||||
{
|
||||
|
@ -140,7 +140,6 @@ VideoBuffer * SaveRenderer::Render(GameSave * save, bool decorations, bool fire)
|
||||
src+=WINDOWW;
|
||||
}
|
||||
tempThumb = new VideoBuffer(pData, width*CELL, height*CELL);
|
||||
if(pData)
|
||||
free(pData);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user