neardal: lib: fix random memory corruption