Instead of doing an extract `strdup` here, you can just write: `original_host = data->host; data->host = NULL;` since the next thing you do is free the `data->host` value anyhow.