diff --git a/lib/roles/http/client/client-handshake.c b/lib/roles/http/client/client-handshake.c
index edceda64c5a3aa81c5da580bdbfb3bca20f71d2d..70cb547198d9efcbfcc26ccf7c33f00c9303ef05 100644
--- a/lib/roles/http/client/client-handshake.c
+++ b/lib/roles/http/client/client-handshake.c
@@ -162,7 +162,7 @@ create_new_conn:
 
 	if (!wsi->client_hostname_copy)
 		wsi->client_hostname_copy =
-			strdup(lws_hdr_simple_ptr(wsi,
+			lws_strdup(lws_hdr_simple_ptr(wsi,
 					_WSI_TOKEN_CLIENT_PEER_ADDRESS));
 
 	/*