Fix a memory leak in bk.c