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

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

 



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


> diff --git a/src/xen/xs_internal.c b/src/xen/xs_internal.c
> index 496c30b..eab18f1 100644
> --- a/src/xen/xs_internal.c
> +++ b/src/xen/xs_internal.c
> @@ -559,7 +550,7 @@ xenStoreDomainGetPCIID(virConnectPtr conn, int id, const char *bdf)
>          VIR_FREE(val);
>  
>          if (match) {
> -            ret = strdup(list[i]);
> +            ignore_value(VIR_STRDUP(ret, list[i]));
>              break;
>          }
>      }

This changes it from quiet to noisy, but none of the callers report an OOM error.

ACK

Jan

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]