diff --git a/lib/context.c b/lib/context.c
index e8066b723548528abe3ed649c7a1f7ba240c95eb..37219cdbc08049b8538d35e1874843a4b73965b5 100644
--- a/lib/context.c
+++ b/lib/context.c
@@ -535,7 +535,7 @@ lws_create_vhost(struct lws_context *context,
 		vh->protocols = lwsp;
 	else {
 		vh->protocols = info->protocols;
-		free(lwsp);
+		lws_free(lwsp);
 	}
 
 	vh->same_vh_protocol_list = (struct lws **)