support hot modification of palette

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
fix memory leak

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>