[libvirt] [PATCH v4 10/13] Adapt to VIR_STRDUP and VIR_STRNDUP in src/xen/*
Ján Tomko
jtomko at redhat.com
Thu May 23 11:28:18 UTC 2013
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
More information about the libvir-list
mailing list