summaryrefslogtreecommitdiffstats
path: root/src/common/image.cpp
diff options
context:
space:
mode:
authorPiotr Dziwinski <piotrdz@gmail.com>2012-12-28 13:37:08 +0100
committerPiotr Dziwinski <piotrdz@gmail.com>2012-12-28 13:37:08 +0100
commit3e4c1a1ad88456ebf201b257b91847bd995c8773 (patch)
tree0e2b83aaa3117ee93a6d96140cc146a9587be41c /src/common/image.cpp
parent4cbb63f5b7824dc48e999401c625adb50075fdca (diff)
downloadcolobot-3e4c1a1ad88456ebf201b257b91847bd995c8773.tar.gz
colobot-3e4c1a1ad88456ebf201b257b91847bd995c8773.tar.bz2
colobot-3e4c1a1ad88456ebf201b257b91847bd995c8773.zip
Replaced malloc/free with new/delete
- now new/delete used everywhere except for CBotStack, which has to be fixed in other way - some segfaults should be fixed with this
Diffstat (limited to 'src/common/image.cpp')
-rw-r--r--src/common/image.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/common/image.cpp b/src/common/image.cpp
index f3cfa34..ef8097e 100644
--- a/src/common/image.cpp
+++ b/src/common/image.cpp
@@ -124,14 +124,14 @@ bool PNGSaveSurface(const char *filename, SDL_Surface *surf)
png_write_info(png_ptr, info_ptr);
png_set_packing(png_ptr);
- row_pointers = static_cast<png_bytep*>( malloc(sizeof(png_bytep)*surf->h) );
+ row_pointers = new png_bytep[surf->h];
for (i = 0; i < surf->h; i++)
row_pointers[i] = static_cast<png_bytep>( static_cast<Uint8 *>(surf->pixels) ) + i*surf->pitch;
png_write_image(png_ptr, row_pointers);
png_write_end(png_ptr, info_ptr);
/* Cleaning out... */
- free(row_pointers);
+ delete[] row_pointers;
png_destroy_write_struct(&png_ptr, &info_ptr);
fclose(fp);