Maybe curl could be rewritten in C++ step by step like mpd (https://musicpd.org). C++ has RAII for resource management which can help a lot by itself. In my opinion the most hateful thing in C is freeing resources on all exit paths.
Although, curl in C++ - the naming would became inappropriate...
Although, curl in C++ - the naming would became inappropriate...