main/curl: fixed "out of memory error"
The backport of the upstream fix: Upstream fix: https://github.com/curl/curl/commit/911714d617c106ed5d553bf003e34ec94ab6a136
Upstream bug: https://github.com/curl/curl/issues/8559
As it was discussed there: !28910 (comment 231288)