Fix NULL argument handling in mbedtls_xxx_free() functions

Signed-off-by: Troy-Butler <squintik@outlook.com>
diff --git a/library/net_sockets.c b/library/net_sockets.c
index edec587..ef89a88 100644
--- a/library/net_sockets.c
+++ b/library/net_sockets.c
@@ -683,7 +683,7 @@
  */
 void mbedtls_net_free(mbedtls_net_context *ctx)
 {
-    if (ctx->fd == -1) {
+    if (ctx == NULL || ctx->fd == -1) {
         return;
     }