Fix leaks and null dereferences in net_crypto
Merge pull request #581 from stal888/csafixes

Fix leaks and null dereferences in net_crypto