It would; you'd just have to supply a custom "free_deleter" in the definition of the unique_ptr that calls free instead of delete. I've used this for Windows System calls like GetAddrInfoExW which requires calling FreeAddrInfoEx when you're done.
std::unique_ptr<ADDRINFOEXW, addrinfo_deleter> holder;
ADDRINFOEXW hint = { .ai_family = AF_UNSPEC };
if (const auto result = GetAddrInfoExW(
sHost
, nullptr
, NS_ALL
, nullptr
, &hint
, std::out_ptr(holder)
, nullptr
, nullptr
, nullptr
, nullptr); result != ERROR_SUCCESS) {
// print error here
}