Fixed a typo in mpv buildscript; took care of potential memory leaks