Fix memory leak when invalid beacon frame isn't used