Generated a patch using WinMerge.
Could you provide me the steps to reproduce the problem of comment > 1024 char?
Choose a programming language to enable comments, like C;
write a line with more than 1023 characters;
push ctrl + q (edit -> comment/uncomment -> toggle block comment).
Did you forget delete  linebuf; in your patch?
Surely I forgot, if it is really necessary (which I don't know). In any case, another patch.
Memory should always be freeed.
new -> delete
malloc -> free
Don't mix both.