bf: fix potential memory leaks.

When some of the error conditions were reached, memory wasn't
being free()'d. This patch fixes those cases.
Merge pull request #1 from tcort/memleak

bf: fix potential memory leaks.