jpbarrette/curlpp

Possible Leak in SList

benldrmn opened this issue · 0 comments

SList::update() is implemented as:

void 
SList::update() 
{
	clear();

	for(std::list<std::string>::const_iterator pos = mData.begin();
			pos != mData.end();
			pos++)
	{
		mList = curl_slist_append(mList, (*pos).c_str());
	}
}

but curl_slist_append may return NULL if anything went wrong, and thus leak since the pointer to the previously allocated mList is lost.

See documentation and possible solution here:
https://curl.se/libcurl/c/curl_slist_append.html