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

Re: [libvirt] [PATCH v4 10/13] Adapt to VIR_STRDUP and VIR_STRNDUP in src/xen/*



On 05/23/2013 05:07 PM, Michal Privoznik wrote:
> On 23.05.2013 13:28, Ján Tomko wrote:
>> On 05/20/2013 07:55 PM, Michal Privoznik wrote:
>>> ---
>>>  src/xen/block_stats.c    | 16 ++++++------
>>>  src/xen/xen_driver.c     |  9 +++----
>>>  src/xen/xen_hypervisor.c | 19 ++++----------
>>>  src/xen/xen_inotify.c    | 15 +++--------
>>>  src/xen/xend_internal.c  | 68 ++++++++++++------------------------------------
>>>  src/xen/xm_internal.c    |  9 +++----
>>>  src/xen/xs_internal.c    | 44 ++++++++++++-------------------
>>>  7 files changed, 56 insertions(+), 124 deletions(-)
>>>
>>
>>
>>> diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
>>> index 66a6c4c..e64a9dd 100644
>>> --- a/src/xen/xm_internal.c
>>> +++ b/src/xen/xm_internal.c
>>> @@ -1140,7 +1137,7 @@ xenXMListIterator(void *payload ATTRIBUTE_UNUSED, const void *name, void *data)
>>>  
>>>      dom = xenDaemonLookupByName(ctx->conn, name);
>>>      if (!dom) {
>>> -        if (!(ctx->names[ctx->count] = strdup(name)))
>>> +        if (VIR_STRDUP(ctx->names[ctx->count], name) < 0)
>>
>> VIR_STRDUP_QUIET
>>
>>>              ctx->oom = 1;
>>>          else
>>>              ctx->count++;
>>
> 
> 
> Would it be possible to rather:
> 
> diff --git a/src/xen/xm_internal.c b/src/xen/xm_internal.c
> index 41eb928..7c05911 100644
> --- a/src/xen/xm_internal.c
> +++ b/src/xen/xm_internal.c
> @@ -1171,8 +1171,6 @@ xenXMListDefinedDomains(virConnectPtr conn, char
> **const names, int maxnames)
>      if (ctx.oom) {
>          for (i = 0; i < ctx.count; i++)
>              VIR_FREE(ctx.names[i]);
> -
> -        virReportOOMError();
>          goto cleanup;
>      }
> 
> 

Sure, I don't see why it wouldn't.

Jan


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