malformed patch at line nnn
This message means that the patchfile is damaged. If you copy-pasted the patch from somewhere, be careful not to modify or damage it. A patchfile contains spaces at the start of lines and these often get lost in copy-paste. The safest mechanism is to download the patchfile and save it somewhere locally. If the browser does not download the patchfile and displays it instead, use File -> Save to save a copy locally.