On Tue, Mar 17, 2015 at 05:46:36PM +0100, Andreas Färber wrote:
[...]
> @@ -1054,7 +1055,12 @@ void pc_hot_add_cpu(const int64_t id, Error **errp)
>
> icc_bridge = DEVICE(object_resolve_path_type("icc-bridge",
> TYPE_ICC_BRIDGE, NULL));
> - pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
> + cpu = pc_new_cpu(current_cpu_model, apic_id, icc_bridge, &local_err);
> + if (local_err) {
> + error_propagate(errp, local_err);
> + return;
> + }
> + object_unref(OBJECT(cpu));
Calling object_unref(NULL) is valid, so you can still keep it simple and
do this:
- pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
+ cpu = pc_new_cpu(current_cpu_model, apic_id, icc_bridge, errp);
+ object_unref(OBJECT(cpu));
--
Eduardo