From 260f9d51666a8f3a7d8f9e15cca18dd15b1f790c Mon Sep 17 00:00:00 2001 From: scawful Date: Wed, 6 Jul 2022 22:39:05 -0400 Subject: [PATCH] memory management --- src/app/gfx/snes_palette.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/gfx/snes_palette.cc b/src/app/gfx/snes_palette.cc index 53e72506..d82580ec 100644 --- a/src/app/gfx/snes_palette.cc +++ b/src/app/gfx/snes_palette.cc @@ -82,13 +82,13 @@ SNESPalette::SNESPalette(const std::vector & cols) { } char* SNESPalette::encode() { - char* data = new char[size_ * 2]; + auto data = std::make_shared(size_ * 2); for (unsigned int i = 0; i < size_; i++) { std::cout << colors[i].snes << std::endl; data[i * 2] = (char)(colors[i].snes & 0xFF); data[i * 2 + 1] = (char)(colors[i].snes >> 8); } - return data; + return data.get(); } SDL_Palette* SNESPalette::GetSDL_Palette() {