qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2 1/3] monitor: Add HMP and QMP interfaces


From: Paolo Bonzini
Subject: Re: [PATCH v2 1/3] monitor: Add HMP and QMP interfaces
Date: Mon, 13 Sep 2021 14:48:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 13/09/21 11:35, Daniel P. Berrangé wrote:
   g_autoptr(Error) err = NULL
I was mistaken here - Error shouldn't use g_autoptr, just

    Error err = NULL;

+    SGXInfo *info = qmp_query_sgx(NULL);
Pass in &err not NULL;

Also  declare it with  'g_autoptr(SGXInfo) info = ...'

And then

    if (err) {
       monitor_printf(mon, "%s\n", error_get_pretty(err);
Then use the simpler:

     error_report_err(err);

Indeed.

That said, more long term (but this is something Coccinelle could help with) perhaps error_report_err should not free the error, and instead we should use g_autoptr(Error) in the callers. I don't like functions that do not have free in their name and yet free a pointer...

Paolo




reply via email to

[Prev in Thread] Current Thread [Next in Thread]