fix memory allocation issue

I guess, there's not much to discuss for this one. Just a plain bug fix to solve an issue in the cursor command.