curl_easy_setopt()that accept a string as its third argument.
CURLOPT_POSTFIELDSonly stores the pointer to the data, meaning an application using this option must keep the memory around for the entire duration of the associated transfer.
CURLOPT_COPYPOSTFIELDSwhich copies the data. If the data is binary and does not stop at the first presence of a null byte, make sure that
CURLOPT_POSTFIELDSIZEis set before this option is used.
CURLOPT_POSTFIELDSis an exception is due to legacy. Originally (before curl 7.17.0), libcurl did not copy any string arguments and when this current behavior was introduced, this option could not be converted over without breaking behavior so it had to keep working like before. Which now sticks out, as no other option does...