[libvirt] [PATCH v2] util: set OOM in virCopyLastError if error is not set

John Ferlan jferlan at redhat.com
Tue Jul 17 19:28:21 UTC 2018



>>> +    } 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 ;-)

John




More information about the libvir-list mailing list