Fix memory leaks

Fix the memory leaks in zbeacon.c and zframe.c identified when src/selftest is run.