Use memory allocator correctly.

This commit is contained in:
castano 2009-06-13 14:17:10 +00:00
parent 8d54d22cb2
commit 8d361eee22

View File

@ -39,10 +39,9 @@ const Image & Image::operator=(const Image & img)
void Image::allocate(uint w, uint h) void Image::allocate(uint w, uint h)
{ {
free();
m_width = w; m_width = w;
m_height = h; m_height = h;
m_data = (Color32 *)nv::mem::malloc(w * h * sizeof(Color32)); m_data = (Color32 *)nv::mem::realloc(m_data, w * h * sizeof(Color32));
} }
bool Image::load(const char * name) bool Image::load(const char * name)
@ -80,7 +79,7 @@ void Image::unwrap()
void Image::free() void Image::free()
{ {
::free(m_data); nv::mem::free(m_data);
m_data = NULL; m_data = NULL;
} }