On 11/24/2010 04:29 PM, Avi Kivity wrote:
+kvm_msrs* vcpu::alloc_msr_list(size_t nmsrs)
+{
+    size_t size = sizeof(kvm_msrs) + sizeof(kvm_msr_entry) * nmsrs;
+    kvm_msrs* ret = static_cast<kvm_msrs*>(malloc(size));
+    if (!ret) {
+    throw ENOMEM;
+    }
+    return ret;
+}

malloc?

Mixing C and C++ allocations is nasty stuff. Would be nicer to new an object and return it such that delete can be used consistently.

5 years of C.

It has to be a malloc() in fact. We're allocating a variable size object that is not an array. You're right that we can't give it to an auto_ptr<> though, since that uses delete.

--
error compiling committee.c: too many arguments to function

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to