[libvirt] [PATCH v2] util: set OOM in virCopyLastError if error is not set
Nikolay Shirokovskiy
nshirokovskiy at virtuozzo.com
Thu Jul 19 08:15:03 UTC 2018
On 17.07.2018 22:28, John Ferlan wrote:
>
>
>>>> + } else {
>>>> + to->code = VIR_ERR_NO_MEMORY;
>>>> + to->domain = VIR_FROM_NONE;
>>>> + to->level = VIR_ERR_ERROR;
>>>
>>> Should we do a VIR_FREE(to->message); so that nothing that was there
>>> before somehow remains... I don't think either agent or monitor> "lastError" is reset until Dispose time.
>>
>> Won't hurt but probably will not be used by monitor or agent. If thread
>> error is not allocated message is NULL upon return, after error is allocated we never
>> hit this OOM branch anymore. Of course hypotetical client can bring @to
>> with message already set so this a bit future proof.
>>
>> I think then we can leave reset and then set these 3 fields.
>>
>> Nikolay
>>
>
> You have commit access and my R-by regardless of whether you add the
> VIR_FREE or not. I leave the rest to you ;-)
>
Thanx! Pushed with reset added.
Nikolay
More information about the libvir-list
mailing list