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

Nikolay Shirokovskiy nshirokovskiy at virtuozzo.com
Fri Jul 20 06:58:21 UTC 2018



On 19.07.2018 20:30, John Ferlan wrote:
> 
> 
> On 07/19/2018 04:15 AM, Nikolay Shirokovskiy wrote:
>>
>>
>> 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
>>
> 
> Oh no, you pushed a local .gnulib too!
> 
> git log -p
> ...
> commit 1bff5bbe25eb7a7e7a4e0067c4ca7cbc1cb34999
> Author: Nikolay Shirokovskiy <nshirokovskiy at virtuozzo.com>
> Date:   Mon Jul 2 14:16:52 2018 +0300
> 
> ...
> diff --git a/.gnulib b/.gnulib
> index cdbf3d385a..d6397dde2e 160000
> --- a/.gnulib
> +++ b/.gnulib
> @@ -1 +1 @@
> -Subproject commit cdbf3d385a32ff904c96f20c26f3470bd8345248
> +Subproject commit d6397dde2e127e246e3eeb5254a21f42cac783c8
> diff --git a/src/util/virerror.c b/src/util/virerror.c
> index f198f27957..5f26d59777 100644
> --- a/src/util/virerror.c
> +++ b/src/util/virerror.c
> 
> 
> ...

Sorry, hope I'll be more careful in the future.

Nikolay




More information about the libvir-list mailing list