> Can you, please, describe how exactly can
> qemuMonitorGetCPUModelExpansion return zero without assigning to
> model_info?
>
> Looking at the code the only way the function could return zero is when
> qemuMonitorJSONParseCPUModel returns zero. And that only happens in one
> place:
>
>     *model_info = g_steal_pointer(&machine_model);
>     return 0;

As I understand:

qemuMonitorGetCPUModelExpansion() returns
qemuMonitorJSONGetCPUModelExpansion() result.

In qemuMonitorJSONGetCPUModelExpansion():

```
if ((rc = qemuMonitorJSONQueryCPUModelExpansionOne(mon, type, &model,
&data)) <= 0)
return rc;
```

qemuMonitorJSONQueryCPUModelExpansionOne() returns zero if the
condition is true:
```
if (qemuMonitorJSONHasError(reply, "GenericError"))
return 0;
```

So the qemuMonitorJSONParseCPUModelExpansion with `*model_info =
g_steal_pointer` won't even be called because of early return.

Reply via email to