libpfctl: Improve error handling in pfctl_get_states()
Ensure that we always free nvlists and other allocated memory.
Reviewed by: scottl
MFC after: 3 days
Sponsored by: Rubicon Communications, LLC ("Netgate")
Differential Revision: https://reviews.freebsd.org/D30493
(cherry picked from commit 27c77f42ae7402c313deec47aa67a8a8e0889410)