diff options
| author | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-19 20:31:24 (GMT) |
|---|---|---|
| committer | Simon Robertshaw <simon@hardwired.org.uk> | 2012-08-19 20:31:24 (GMT) |
| commit | 43ed72b4c5c803eaac0af7589f25a9f74e1df33b (patch) | |
| tree | 3a82a99df0fc5aae157b5a0db37b7f6bec24642d /src/client/Client.cpp | |
| parent | 9dd9d525648fa941419e13bedd498d634b0b136b (diff) | |
| download | powder-43ed72b4c5c803eaac0af7589f25a9f74e1df33b.zip powder-43ed72b4c5c803eaac0af7589f25a9f74e1df33b.tar.gz | |
Fix a few small (a lot of big) memory leaks associated with the stamps browser
Diffstat (limited to 'src/client/Client.cpp')
| -rw-r--r-- | src/client/Client.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/client/Client.cpp b/src/client/Client.cpp index ad5e458..4799d9a 100644 --- a/src/client/Client.cpp +++ b/src/client/Client.cpp @@ -813,7 +813,7 @@ SaveFile * Client::GetStamp(std::string stampID) size_t fileSize = stampFile.tellg(); stampFile.seekg(0); - unsigned char * tempData = (unsigned char *)malloc(fileSize); + unsigned char * tempData = new unsigned char[fileSize]; stampFile.read((char *)tempData, fileSize); stampFile.close(); @@ -826,8 +826,10 @@ SaveFile * Client::GetStamp(std::string stampID) } catch (ParseException & e) { + delete[] tempData; std::cerr << "Client: Invalid stamp file, " << stampID << " " << std::string(e.what()) << std::endl; } + delete[] tempData; return file; } else |
