From 42a2c252b860374e63e8ca9c9a4ae079f27c63f3 Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Fri, 30 May 2014 13:38:09 -0700 Subject: use malloc/free from c++: fixes compile with libc++ on linux - refs #287 --- src/util/image.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/util/image.cpp') diff --git a/src/util/image.cpp b/src/util/image.cpp index 156828183f..2d4eb36021 100644 --- a/src/util/image.cpp +++ b/src/util/image.cpp @@ -2,6 +2,7 @@ #include #include +#include std::string llmr::util::compress_png(int width, int height, void *rgba, bool flip) { @@ -137,7 +138,7 @@ Image::Image(const std::string &data) { png_size_t rowbytes = png_get_rowbytes(png, info); assert(width * 4 == rowbytes); - img = (char *)malloc(width * height * 4); + img = (char *)std::malloc(width * height * 4); char *surface = img; assert(surface); @@ -160,7 +161,7 @@ Image::Image(const std::string &data) { fprintf(stderr, "loading PNG failed: %s\n", e.what()); png_destroy_read_struct(&png, &info, nullptr); if (img) { - free(img); + std::free(img); img = nullptr; } width = 0; @@ -170,7 +171,7 @@ Image::Image(const std::string &data) { Image::~Image() { if (img) { - free(img); + std::free(img); img = nullptr; } } -- cgit v1.2.1