fix a memory leak in ws2812_buffer_shift by freeing the same amount of bytes we allocated before

This commit is contained in:
Firenox89 2020-06-12 03:38:13 +02:00 committed by Nathaniel Wesley Filardo
parent 06aa248f08
commit 0555a4c689
1 changed files with 2 additions and 1 deletions

View File

@ -278,7 +278,8 @@ int ws2812_buffer_shift(lua_State* L, ws2812_buffer * buffer, int shiftValue, un
ws2812_buffer_shift_prepare* prepare = ws2812_buffer_get_shift_prepare(L, buffer, shiftValue, shift_type, pos_start, pos_end);
ws2812_buffer_shift_prepared(prepare);
// Free memory
luaM_free(L, prepare);
luaM_freemem(L, prepare, sizeof(ws2812_buffer_shift_prepare) + prepare->shift_len);
return 0;
}