Fix memory leak in sop_get_pqi_device_capabilities()
inline some critical functions