fix failure to free memory

The applypatch function is somewhat sloppy about freeing memory (since
it was originally a standalone binary).  Fix some of that.

Change-Id: Ifd44d71ea189c0b5115493119fd57bc37533fd59
2 files changed