diff --git a/std/net/curl.d b/std/net/curl.d index b26df2d9149..12b101b07d8 100644 --- a/std/net/curl.d +++ b/std/net/curl.d @@ -3339,7 +3339,9 @@ struct Curl private string errorString(CurlCode code) { - return format("%s on handle %s", to!string(curl_easy_strerror(code)), handle); + auto msgZ = curl_easy_strerror(code); + // doing the following (instead of just using std.conv.to!string) avoids 1 allocation + return format("%s on handle %s", cast(string) msgZ[0 .. core.stdc.strlen(msgZ)], handle); } private void throwOnStopped(string message = null)